Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 sp_add_notification (Transact-SQL)
Community Content
In this section
Statistics Annotations (0)
Other versions are also available for the following:
SQL Server 2008 Books Online (December 2008)
sp_add_notification (Transact-SQL)

Sets up a notification for an alert.

Topic link icon Transact-SQL Syntax Conventions

sp_add_notification [ @alert_name = ] 'alert' , 
    [ @operator_name = ] 'operator' , 
    [ @notification_method = ] notification_method
[ @alert_name = ] 'alert'

The alert for this notification. alert is sysname, with no default.

[ @operator_name = ] 'operator'

The operator to be notified when the alert occurs. operator is sysname, with no default.

[ @notification_method = ] notification_method

The method by which the operator is notified. notification_method is tinyint, with no default. notification_method can be one or more of these values combined with an OR logical operator.

Value Description

1

E-mail

2

Pager

4

net send

0 (success) or 1 (failure)

None

sp_add_notification must be run from the msdb database.

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

To send a notification in response to an alert, you must first configure SQL Server Agent to send mail. For more information, see SQL Server Agent Mail.

If a failure occurs when sending an e-mail message or pager notification, the failure is reported in the SQL Server Agent service error log.

Only members of the sysadmin fixed server role can execute sp_add_notification.

The following example adds an e-mail notification for the specified alert (Test Alert).

ms173843.note(en-us,SQL.100).gifNote:
This example assumes that Test Alert already exists and that François Ajenstat is a valid operator name.

USE msdb ;
GO

EXEC dbo.sp_add_notification
 @alert_name = N'Test Alert',
 @operator_name = N'François Ajenstat',
 @notification_method = 1 ;
GO
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker