O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing the Alert Notification

To test your new alert notification, you open a new query window in SMSS and enter the following code:

USE AdventureWorks2012goRAISERROR('This is an alert mail test', 10, 1) WITH LOGgo'This is an alert mail test'

Because you specified WITH LOG, this simple statement writes an event to the Windows Event log, which in turn triggers the alert because the database context, message text, and severity all match the conditions of the alert. An email message should have appeared in your inbox, indicating the alert’s successful triggering. This message should contain body text such as this:

DATE/TIME:    5/7/2009 9:00:45 PMDESCRIPTION:    Error: 50000 Severity:  10 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required