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
Related videos on Youtube
![Chris Canal](https://lh6.googleusercontent.com/-Nj95YcfakVE/AAAAAAAAAAI/AAAAAAAAARw/j4jRhxeYElI/photo.jpg?sz=256)
Author by
Chris Canal
Updated on September 18, 2022Comments
-
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 almost 15 yearsCheers 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 almost 15 yearsAh, yes. I'm with you now. gbn's got it in his answer. Alerts are the way to go for general purpose things.