I am querying a Sybase SQL Anywhere 17 database to get a count from a table, and outputting that count (number) to a txt file. Running in cmd window is fine, but running via batch script gives a different result.
The following works exactly as it should via Windows cmd line:
dbisql -datasource=DATABASEHERE -c "UID=USERNAMEHERE;PWD=PASSWORDHERE" SELECT COUNT(*) FROM "DRSYS"."Online" WHERE Status LIKE 'S%'; OUTPUT to OnlineUnreadCount.txt
Let's say that output is "190"
However, when running it via batch script, which is:
@echo off
dbisql -datasource=DATABASEHERE -c "UID=USERNAMEHERE;PWD=PASSWORDHERE" SELECT COUNT(*) FROM "DRSYS"."Online" WHERE Status LIKE 'S%'; OUTPUT to OnlineUnreadCount.txt
It runs and outputs, but the number in the txt file is "133" instead of the expected "190". What am I doing wrong? I cannot see where the difference is.