Sets up a notification for an alert.
sp_add_notification [@alert_name =] 'alert',
[@operator_name =] 'operator',
[@notification_method =] notification_method
Value | Description |
---|---|
1 | |
2 | Pager |
4 | net send |
0 (success) or 1 (failure)
None
sp_add_notification must be run from the msdb database.
SQL Server Enterprise Manager provides an easy, graphical way to manage the entire alerting system. Using SQL Server Enterprise Manager is the recommended way to configure your alert infrastructure.
To send a notification in response to an alert, you must first configure Microsoft® SQL Server™ Agent to send mail. For more information, see Configuring the SQLServerAgent Service.
If a failure occurs when sending an e-mail message or pager notification, the failure is reported in the SQL Server Agent error log.
Only members of the sysadmin fixed server role can execute sp_add_notification.
This example adds an e-mail notification for the specified alert (Test Alert).
Note This example assumes that Test Alert already exists and that stevenb is a valid operator name.
USE msdb
GO
EXEC sp_add_notification 'Test Alert', 'stevenb', 1
sp_delete_notification | sp_update_notification |
sp_help_notification | System Stored Procedures |