I am using a batch file to run SQL statements from another file. How do I log the result or error message on a text file in same folder. Here is what I have done:"
@echo off
sqlcmd.exe -S "(localdb)\v11.0" -i C:\SQLBatch\CreateLinkServer.sql -o C:\SQLBatchCreateLinkServer.txt
The log file (SQLBatchCreateLinkServer.txt) only contains "Changed database context to 'master'.". How do I get the batch to write all the details in the log such as no. of rows affected and which query is being excuted.
Thank you