SQL Server Agent Alerts and C# or .NET

  • alex.sqldba

    SSChampion

    Points: 10045

    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

  • Sue_H

    SSC Guru

    Points: 89894

    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

  • alex.sqldba

    SSChampion

    Points: 10045

    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

  • Johan Bijnens

    SSC Guru

    Points: 134254

    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


    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[/url] :alien: but most of the time this is me :hehe:

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

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