Removing report header from a scheduled Transact-SQL job

  • I posted this under another area but had 0 replies so I am thinking it may be in the wrong group.... trying again.  Thanks for any help

    I am running a job from within enterprise manager, SQL agent.  This is a job type of Transact-Sql Script.  Basically the job executes a simple SQL query and it then writes it out to a file using the "Output file" option from the advanced options of the job definition.

    My problem is that the output file has a header in it which includes the job name and the create date/time.  Instead, I just need the raw output from the query without any headers. 

    Any ideas?  I have very little SQL experience so any solid explanations would be very appreciated.  Thank you for your help!

  • Try this:  Create another job step (CMD EXEC) after the output file has been created, which strips the first x number of lines out of the output file, making you a "new" final output file.

    It would look something like this:

    MORE +x filename.txt >> finaloutput.txt

    "x" is a number representing the number of lines to skip before reproducing the output.

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply