sp_help_notification (Transact-SQL)

 

Updated: August 9, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Reports a list of alerts for a given operator or a list of operators for a given alert.

Topic link icon Transact-SQL Syntax Conventions

  
sp_help_notification  
     [ @object_type = ] 'object_type' ,  
     [ @name = ] 'name' ,  
     [ @enum_type = ] 'enum_type' ,   
     [ @notification_method = ] notification_method   
     [ , [ @target_name = ] 'target_name' ]   

[ @object_type =] 'object_type'
The type of information to be returned. object_typeis char(9), with no default. object_type can be ALERTS, which lists the alerts assigned to the supplied operator name, or OPERATORS, which lists the operators responsible for the supplied alert name.

[ @name =] 'name'
An operator name (if object_type is OPERATORS) or an alert name (if object_type is ALERTS). name is sysname, with no default.

[ @enum_type =] 'enum_type'
The object_typeinformation that is returned. enum_type is ACTUAL in most cases. enum_typeis char(10), with no default, and can be one of these values.

ValueDescription
ACTUALLists only the object_types associated with name.
ALLLists all theobject_types including those that are not associated with name.
TARGETLists only the object_types matching the supplied target_name, regardless of association withname.

[ @notification_method =] notification_method
A numeric value that determines the notification method columns to return. notification_method is tinyint, and can be one of the following values.

ValueDescription
1E-mail: returns only the use_email column.
2Pager: returns only the use_pager column.
4NetSend: returns only the use_netsend column.
7All: returns all columns.

[ @target_name =] 'target_name'
An alert name to search for (if object_type is ALERTS) or an operator name to search for (if object_type is OPERATORS). target_name is needed only if enum_type is TARGET. target_name is sysname, with a default of NULL.

0 (success) or 1 (failure)

If object_type is ALERTS, the result set lists all the alerts for a given operator.

Column nameData typeDescription
alert_idintAlert identifier number.
alert_namesysnameAlert name.
use_emailintE-mail is used to notify the operator:

 1 = Yes

 0 = No
use_pagerintPager is used to notify operator:

 1 = Yes

 0 = No
use_netsendintNetwork pop-up is used to notify the operator:

 1 = Yes

 0 = No
has_emailintNumber of e-mail notifications sent for this alert.
has_pagerintNumber of pager notifications sent for this alert.
has_netsendintNumber of net send notifications sent for this alert.

If object_type is OPERATORS, the result set lists all the operators for a given alert.

Column nameData typeDescription
operator_idintOperator identification number.
operator_namesysnameOperator name.
use_emailintE-mail is used to send notification of the operator:

 1 = Yes

 0 = No
use_pagerintPager is used to send notification of the operator:

 1 = Yes

 0 = No
use_netsendintIs a network pop-up used to notify the operator:

 1 = Yes

 0 = No
has_emailintOperator has an e-mail address:

 1 = Yes

 0 = No
has_pagerintOperator has a pager address:

 1 = Yes

 0 = No
has_netsendintOperator has net send notification configured.

 1 = Yes

 0 = No

This stored procedure must be run from the msdb database.

To execute this stored procedure, a user must be a member of the sysadmin fixed server role.

A. Listing alerts for a specific operator

The following example returns all alerts for which the operator François Ajenstat receives any kind of notification.

USE msdb ;  
GO  
  
EXEC dbo.sp_help_notification   
    @object_type = N'ALERTS',  
    @name = N'François Ajenstat',  
    @enum_type = N'ACTUAL',  
    @notification_method = 7 ;  
GO  

B. Listing operators for a specific alert

The following example returns all operators who receive any kind of notification for the Test Alert alert.

USE msdb ;  
GO  
  
EXEC sp_help_notification  
    @object_type = N'OPERATORS',  
    @name = N'Test Alert',  
    @enum_type = N'ACTUAL',  
    @notification_method = 7 ;  
GO  

sp_add_notification (Transact-SQL)
sp_delete_notification (Transact-SQL)
sp_update_notification (Transact-SQL)
System Stored Procedures (Transact-SQL)

Community Additions

ADD
Show: