SQL job output to Event Log

  • I am attempting to monitor a table so that we can send an alert through MOM when certain criteria are met.

    What I want to do is create a SQL job that will run daily and query the table and send it's output to the Windows Event Log so that MOM can look for a certain phrase and fire off an alert.

    Unfortunately I do not have access to a mail account so I cannot set up to SQL Mail to use xp_sendmail to send off the result set.

    When setting up a SQL job you can have the job log an event. But it only reports whether the job was successful or if it failed. it does not return the details of the result set.

    Is anyone aware of another extended sp or some other method that would allow me to send the results of a query to the Event Log?

    Thanks,

    Chris

  • To log a message in the Event Log you can use the RAISERROR command with a low severity, or xp_logevent.

    You would need to "massage" your query result into a text string first.

     

     

    --------------------
    Colt 45 - the original point and click interface

  • See my article on RAISERROR. It may help

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

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