sp_addnotification SQL Executive Stored Procedure

Sets up a notification for an alert.

Syntax

sp_addnotification alert_name, operator_name, notification_method

where

alert_name
Specifies which alert this notification is for.
operator_name
Specifies the operator to be notified when the alert occurs.
notification_method
Indicates the method by which the operator will be notified. Can be EMAIL, PAGER, or BOTH.

Remarks

This stored procedure must be run from the msdb database.

To send a notification in response to an alert, you must first configure SQLServer to send mail. For details, see the Microsoft SQL Server Administrator's Companion.

You can add a notification for an operator who does not have the necessary address information to be notified by using the specified notification_method. If a failure occurs when sending an e-mail message or pager notification, the failure is reported in the Windows NT application event log.

SQL Enterprise Manager provides an easy, graphical way to manage the entire alerting system. Using SQL Enterprise Manager is the recommended way to configure your alert infrastructure.

Example

This example adds a notification for the specified alert ('Test Alert').

EXEC sp_addnotification 'Test Alert', 'John Doe', EMAIL

Permission

Only the system administrator can use this procedure.

Tables Used

sysalerts, sysnotifications, sysoperators

See Also

sp_dropnotification sp_updatenotification
sp_helpnotification