Configure a SQL Server Agent Operator

SQL Server Agent operators are used by SQL Server Agent to send notifications about events as they happen. Typically, this would include notifications that a SQL Server Agent Job failed during execution. You might also want to be notified if SQL Server Agent detects corruption on a database, or a log-full event, etc. The code in this post provides a simple method of creating an operator without using the point-and-click GUI, which might be a bit cumbersome, and can’t be easily scripted.

Pont au Change au Crepscule, by Edouard Cortès - theres an operator in there somewhere!

Pont au Change au Crepscule, by Edouard Cortès – theres an operator in there somewhere!

Specify the operator name and email address at the top of the script, via the @OperatorName and @EmailAddress parameters. If you want to replace an existing operator, set the @DropExistingOperator to 1.

The code above uses the built-in MSDB stored procedures, sp_add_category and sp_add_operator.

Check out the rest of our posts on SQL Server Agent. If you found this post helpful, please share it!

Ads by Google, Paying the Rent: