Can Sql Server send an email alert if a RAISEERROR has be raised?

5,021

You associate an SQL Agent "alert" to detect the error, which then sends an email to an "operator" or runs a job.

You use sp_add_alert but the main info is here: Monitoring and Responding to Events

Share:
5,021

Related videos on Youtube

Chris Canal
Author by

Chris Canal

Updated on September 18, 2022

Comments

  • Chris Canal
    Chris Canal almost 2 years

    is it possible to get the Sql Server 2008 to send an email when a query RAISEERROR is thrown .. or at the very least, when a RAISEERROR with a predetermined error code or codes?

  • Chris Canal
    Chris Canal almost 15 years
    Cheers for the answer :) What about an auto way, without having to manually putting that code in each stored proc/query ... like .. some autotrigger event thing?
  • squillman
    squillman almost 15 years
    Ah, yes. I'm with you now. gbn's got it in his answer. Alerts are the way to go for general purpose things.