SQL Server Agent Alerts and C# or .NET

  • Morning All,

    SQL Server Agent can generate alerts. Does anyone know if they can be consumed by a .NET application rather than relying on an Operator to forward them?

    IF so, how so?

    Cheers
    Alex

  • Not sure exactly what you want to do, probably me and not enough coffee yet, but the response to alerts is either an operator or a job so it doesn't necessarily have to go through an operator. And a job could do a lot of different things. And the alert doesn't necessarily need to have a response. The firing of alerts, the last date and time, number of occurrences is in the sysalerts table in msdb. So it seems different things could be done outside of using an operator.

    Sue

  • Sue_H - Wednesday, April 12, 2017 8:44 AM

    Not sure exactly what you want to do, probably me and not enough coffee yet, but the response to alerts is either an operator or a job so it doesn't necessarily have to go through an operator. And a job could do a lot of different things. And the alert doesn't necessarily need to have a response. The firing of alerts, the last date and time, number of occurrences is in the sysalerts table in msdb. So it seems different things could be done outside of using an operator.

    Sue

    The firing of alerts, the last date and time, number of occurrences is in the sysalerts table in msdb.

    This is what I was unable to articulate, exactIy.
    For a moment I wondered if there was a Windows Event I could capture in .NET but really, all I need to keep an eye on the sysalerts you mentioned.

    Thanks Sue!  Perfect Answer!

    Cheers
    Alex

  • just a little caution:
    If you have an alert activating a job, and you disable the job without disabling the alert, your SQLAGENT.OUT file will explode because it still tries to launch the job until that succeeds ( about 6 times a second, all logged in that sqlagent.out file )

    For sqlagent to act on its first alert, you may need to restart it.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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