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

alertsemailsql-server-2008

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?

Best Answer

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