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

Article translations Article translations
Article ID: 294412 - View products that this article applies to.
This article was previously published under Q294412
BUG #: 353170 (SHILOH_BUGS)
Expand all | Collapse all

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 "Implementing Jobs" topic in Books Online.

Properties

Article ID: 294412 - Last Review: November 6, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbbug kbpending KB294412

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com