Email Alerts when something goes wrong with SQL Server

Here’s how to configure your SQL Server to send alert notifications when something goes wrong.

Step 1: Define an Operator. Open SQL Server Management Studio (SSMS) 2008 > Expand SQL Server Agent Node > Right click on Operators > New Operator > Enter a Name of the operator in the Name section. Provide an E-mail address, Net send address, or Pager address or all the three the operator.

For this example, I am using only the E-mail address as shown below. Click OK.


Step 2: Let’s now define a new alert. This alert could be based on an error code or severity, or SQL Server performance or WMI event alert.

Right click the Alerts folder > New Alert > define an alert name > choose ‘SQL Server Event alert’ as the alert type > choose ‘all databases’ and in the severity, choose 011 – to raise an error when a specified database object is not found'


Select the Response tab now > check the ‘Notify operators’ checkbox and select Admin from the operator list with the Email option.


Click OK and an alert has been set. You should be receiving emails now whenever a query fails because of a missing database object. Make sure you have set up SQL Server Database Mail for the email to work.

About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

1 comment:

Maritey H said...

bravo! I always wanted to do something like this can you also show how to do database mail?