Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 sql server job history custom message?

Author  Topic 

rb1373
Yak Posting Veteran

93 Posts

Posted - 2005-07-15 : 15:41:25
How do I get a custom message to appear in the SQL Server Agent Job History error/message area?

I have a job with 1 step that has this TSQL: "select getdate()". When I run start the job, I would like the results of the TSQL or a custom message to appear in the Job History error/message area.

Right now when I start the job and view the history, the error/message area reads (show step details is checked):

"Executed as user: MyDomain\ray. The step succeeded."

If writing to the eror/message area can be done, I plan on using the step to manipulate data, and I would like to see number of rows affected, etc in the error/message area.

Let me know if this can be done.

Thanks.

- ray

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-15 : 15:50:07
Your job step just needs to output the information and it'll be included in the job details. For testing, do this in your job: PRINT GETDATE(). To see what will make it in there, you can test it out in Query Analyzer by using grid mode. What prints in the grid will not appear in the job details. What prints in the messages will appear in the job details. Rows affected does not though, so they must be using SET NOCOUNT ON. But you can easily get that info with @@ROWCOUNT.

Tara
Go to Top of Page
   

- Advertisement -