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 ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.