Tuesday 15 January 2013

write to windows event viewer from sql server job -


I am working with SQL Server 2012 and setting up some jobs to run at different times during the day Is of If the job fails then I should be given such a warning.

On the server, I have some software that monitors the event viewer. If the job fails then I would like to set my job to write server event viewer. I want to write event id 999 and with error level.

How can I set up my job to do this?

You can use the SQL-order

  EXEC master. Dbo.xp_logevent 60000, 'test message', informative   

but it does not allow you to set "event id", you can only set "error number"

Or you can create a "power shell" like a job phase:

  write- eventlog system - source server-avenited 12345 - message "I am a custom event log message" / Code>  

and only the previous step failure card Enter job step Y

No comments:

Post a Comment