Assign Alerts to an Operator
This topic describes how to assign Microsoft SQL Server Agent alerts to operators so they can receive notifications about jobs in SQL Server 2016 by using SQL Server Management Studio or Transact-SQL.
In This Topic
Before you begin:
To assign alerts to an operator, using:
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 Configure SQL Server Agent Mail to Use Database 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 assign alerts to operators.
In Object Explorer, click the plus sign to expand the server that contains the operator to which you want to assign an alert.
Click the plus sign to expand SQL Server Agent.
Click the plus sign to expand the Operators folder.
Right-click the operator to which you want to assign an alert and select Properties, and select the Notifications page.
In the operator_nameProperties dialog box, under Select a page, select Notifications.
Under View notifications sent to this user by, select Alerts to view a list of alerts sent to this operator or select Jobs to view a list of jobs that send notifications to this operator. Select one or more of the following checkboxes to define the notification method for each notification as necessary: E-mail, Pager, or Net send.
When finished, click OK.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
-- adds an e-mail notification for the specified alert (Test Alert) -- 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
For more information, see sp_add_notification (Transact-SQL).