April 27, 2011 at 11:23 am
I have 4 SQL's that I process using SQLCMD. I have the output redirecting to log files. Most of the time a log file will be created showing some number of records updated/deleted. There are other times when nothing is created. When that happens I can run the SQL command using SQL Server and it will display 0 records updated/deleted.
Any ideas as to why when it is 0 that no log gets created?
I have included the following in the SQL's and I am still not getting a log file created.
:out out.txt
set nocount off
Command that get run:
call "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd" -U hrm_usr -P xxxx -S 0000serppcls1b\erp1b -d HRMPROD -i C:\AMSADV3\AMSJobInteractionClient\scripts\HRMPRODJBMGR\SQL\RegGTN\No_Hours.sql > %LOGDIR%\RegGTN\No_Hours.txt 2>&1
copy out.txt %LOGDIR%\RegGTN\No_Hours.txt
The No_Hours.txt is created with 0kb.
Any help would be greatly appreciated.
April 28, 2011 at 8:39 am
call "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd" -U hrm_usr -P xxxx -S 0000serppcls1b\erp1b -d HRMPROD -i C:\AMSADV3\AMSJobInteractionClient\scripts\HRMPRODJBMGR\SQL\RegGTN\No_Hours.sql
-o %LOGDIR%\RegGTN\No_Hours.txt
Would that work for you?
May 12, 2011 at 9:28 am
I have tried using the -o option on sqlcmd and I am getting the same results o f0kb file generated.
Does anyone else have any other thoughts as to how to get the log to show the results?
May 12, 2011 at 9:36 am
If you dont log to the log file, are you able to echo the output to the command prompt ?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply