50 pts.
 SQLCMD does not create a log file
I have several SQL update/delete statements I run during a payroll cycle. When I run a SQL that does not have any records that meet the selection criteria, I do not get a log created. I can run the same SQL in SQLServer, and it shows (0 records updated).

Software/Hardware used:
ASKED: January 5, 2011  5:52 PM
UPDATED: January 21, 2011  5:08 PM

Answer Wiki:
</pre> Should have been: > %LOGDIR%RegGTNPERS_09_RATE_FIX.log 2>&1
Last Wiki Answer Submitted:  January 6, 2011  5:27 pm  by  Harv2002   50 pts.
All Answer Wiki Contributors:  Harv2002   50 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Are you asking about doign this on an AS400?

 32,785 pts.

 

No this is being done on SQLServer.
I am using a redirect statement like this:
> %LOGDIR%RegGTNPERS_09_RATE_FIX.log 2>&1

Most of these work OK, except for when the resukts equal 0 records for some of my SQL’s

 50 pts.

 

It should have been:
> %LOGDIR%RegGTNPERS_09_RATE_FIX.log 2>&1

 50 pts.

 

Try adding SET NOCOUNT OFF to your SQL.

 690 pts.

 

I have added the SET NOCOUNT OFF to my SQL’s and I am still not getting any logs created when no records qualify.

Any other ideas.

 50 pts.