Export (0) Print
Expand All
Expand Minimize

sp_add_operator

SQL Server 2000

Creates an operator (notification recipient) for use with alerts and jobs.

Syntax

sp_add_operator [ @name = ] 'name'
    [ , [ @enabled = ] enabled ]
    [ , [ @email_address = ] 'email_address' ]
    [ , [ @pager_address = ] 'pager_address' ]
    [ , [ @weekday_pager_start_time = ] weekday_pager_start_time ]
    [ , [ @weekday_pager_end_time = ] weekday_pager_end_time ]
    [ , [ @saturday_pager_start_time = ] saturday_pager_start_time ]
    [ , [ @saturday_pager_end_time = ] saturday_pager_end_time ]
    [ , [ @sunday_pager_start_time = ] sunday_pager_start_time ]
    [ , [ @sunday_pager_end_time = ] sunday_pager_end_time ]
    [ , [ @pager_days = ] pager_days ]
    [ , [ @netsend_address = ] 'netsend_address' ]
    [ , [ @category_name = ] 'category' ]

Arguments

[@name =] 'name'

Is the name of an operator (notification recipient). This name must be unique and cannot contain the percent (%) character. name is sysname, with no default.

[@enabled =] enabled

Indicates the current status of the operator. enabled is tinyint, with a default of 1 (enabled). If 0, the operator is not enabled and does not receive notifications.

[@email_address =] 'email_address'

Is the e-mail address of the operator. This string is passed directly to the e-mail system. email_address is nvarchar(100), with a default of NULL.

Note  If email_address or pager_address is a physical address ('SMTP:jdoe@xyz.com') rather than an alias ('jdoe'), the value must be enclosed in square brackets: '[SMTP:jdoe@xyz.com]'.

[@pager_address =] 'pager_address'

Is the pager address of the operator. This string is passed directly to the e-mail system. pager_addresss is narchar(100), with a default of NULL.

[@weekday_pager_start_time =] weekday_pager_start_time

Is the time after which Microsoft® SQL Server™ Agent sends pager notification to the specified operator on the weekdays, from Monday through Friday. weekday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@weekday_pager_end_time =] weekday_pager_end_time

Is the time after which SQLServerAgent service no longer sends pager notification to the specified operator on the weekdays, from Monday through Friday. weekday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@saturday_pager_start_time =] saturday_pager_start_time

Is the time after which SQL Server Agent service sends pager notification to the specified operator on Saturdays. saturday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@saturday_pager_end_time =] saturday_pager_end_time

Is the time after which SQLServerAgent service no longer sends pager notification to the specified operator on Saturdays. saturday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@sunday_pager_start_time =] sunday_pager_start_time

Is the time after which SQLServerAgent service sends pager notification to the specified operator on Sundays. sunday_pager_start_time is int, with a default of 090000, which indicates 9:00 A.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@sunday_pager_end_time =] sunday_pager_end_time

Is the time after which SQLServerAgent service no longer sends pager notification to the specified operator on Sundays. sunday_pager_end_time is int, with a default of 180000, which indicates 6:00 P.M. on a 24-hour clock, and must be entered using the form HHMMSS.

[@pager_days =] pager_days

Is a number that indicates the days that the operator is available for pages (subject to the specified start/end times). pager_days is tinyint, with a default of 0 indicating the operator is never available to receive a page. Valid values are from 0 through 127. pager_days is calculated by adding the individual values for the required days. For example, from Monday through Friday is 2+4+8+16+32 = 62.

Value Description
1 Sunday
2 Monday
4 Tuesday
8 Wednesday
16 Thursday
32 Friday
64 Saturday

[@netsend_address =] 'netsend_address'

Is the network address of the operator to whom the network message is sent. netsend_address is nvarchar(100), with a default of NULL.

[@category_name =] 'category'

Is the name of the category for this alert. category is sysname, with a default of NULL.

Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Remarks

sp_add_operator must be run from the msdb database.

Paging is supported by the e-mail system, which must have an e-mail-to-pager capability if you want to use paging.

SQL Server Enterprise Manager provides an easy, graphical way to manage jobs, and is the recommended way to create and manage the job infrastructure.

Permissions

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

Examples

This example sets up the operator information for janetl. The operator information is enabled, and she is to be notified by pager from Monday through Friday from 8 A.M. to 5 P.M.

use msdb
exec sp_add_operator @name = 'Janet Leverling',
   @enabled = 1,
   @email_address ='janetl',
   @pager_address = '5673219@mypagerco.com',
   @weekday_pager_start_time = 080000,
   @weekday_pager_end_time = 170000,
   @pager_days = 62

See Also

sp_delete_operator

sp_help_operator

sp_update_operator

System Stored Procedures

Show:
© 2014 Microsoft