Microsoft KB Archive/294412

= BUG: SQLAgent T-SQL Job Does Not Respect SET NOCOUNT ON When Sending Output to File =

Article ID: 294412

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q294412



BUG #: 353170 (SHILOH_BUGS)



SYMPTOMS
When you create a T-SQL job step that contains SET NOCOUNT ON, and you send the results to an output file, that file may still contain the rowcount line.



WORKAROUND
Change the job step type to Operating System Command (CmdExec) and Osql.exe. If it's a single query, pass the query using the -Q parameter and specify the output file using the -o parameter.

If the job step contains multiple queries, save them in a script file, pass the script file to Osql.exe using the -i parameter, and specify the output file using the -o parameter. For more information, see SQL Server Books Online.



STATUS
Microsoft has confirmed this to be a problem in SQL Server 2000.



MORE INFORMATION
To reproduce this problem, use SQL Enterprise Manager to create a job that contains the following T-SQL script as a job step: set nocount on select * from pubs.dbo.sales On the Advanced tab for that job step, specify that the output should go to an output file. Then, after running the job, open that output file in any text editor and you will see the following line at the bottom: (21 rows(s) affected) For additional information about setting up and running jobs, see the &quot;Implementing Jobs&quot; topic in Books Online.

Keywords: kbbug kbpending KB294412

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.