I need to query sql server database using batch file. I put these cmdlines in the batch file. When I run the batch file. Cursor stays there after making trusted connection.
OSQL -E
use db1
SELECT count(*) FROM table_01 t1
left join table_02 t2 on t1.tableID = t2.tableID
WHERE t1.Date < '20110724'
Go
Any suggestions please?
osql has a simple fature.
For example I run an SQL command from e:\backupdb.txt with
osql -S servername -U user -P password -i e:\backupdb.txt
it does the job