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?
|
feedback
|
|
You associate an SQL Agent "alert" to detect the error, which then sends an email to an "operator" or runs a job. You use | |||
|
feedback
|
|
Yes, you can put a try/catch block in and send an email using database mail. It'd go something like this:
You can use @@Error in the CATCH block to detect the specific error level that was thrown. Here's more on the TRY/CATCH statement | |||||
feedback
|