I've created a script that outputs data in an XML format, and was using SQL Server Agent (Job Step of Type 'Operating System (cmdexec)') to run a job monthly/quarterly to output the data to a specific file. However, the issue that we are running into is that the output from the SQLCMD script:
sqlcmd -d <Database> -i "<Package>\<SQLFile>.sql" -o "<OutputFilePath>\<FileName>.xml" -y 0
is outputting the 'Messages' as well as the 'Results'. Is there a way to only write the results via sqlcmd?
I've removed a few messages including:
"Warning: Null value is eliminated by an aggregate or other SET operation. "
"(1 row affected)"
By using the following Code:
SET NOCOUNT ON
SET ANSI_WARNINGS OFF
GO
Thanks for your suggestions!