Output from a scheduled job

  • 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!

     

  • Anyone?  Any ideas

  • Change the type to Operating System Command and execute the query using -osql command.  I learned this technique after searching the web for monitoring scripts.

  • How do I execute as an O-sql command.  Is this still from within the SQL agent scheduler?

  • How do I execute as an O-sql command.  Is this still from within the SQL agent scheduler?

  • I found a command called "Set heading off" but this looks to be a SQL plus command and it is showing as an invalid command when I run my SQL query.

    Any ideas on another form of this command for non-sql plus?

     

  • The osql utility is described in Books Online. Example:   

    osql -E -Sservername -Q"query"

    When you create a job step, it normally defaults to T-SQL.  When you edit a job step, change the type to Operating System Command on the General tab.

     

Viewing 7 posts - 1 through 6 (of 6 total)

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