sp_notify_operator (Transact-SQL)
Sends an e-mail message to an operator using Database Mail.
By default, members of the sysadmin fixed server role can execute this stored procedure. Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb database:
-
SQLAgentUserRole
-
SQLAgentReaderRole
-
SQLAgentOperatorRole
For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.
The following example sends a notification e-mail to the operator François Ajenstat using the AdventureWorks Administrator Database Mail profile. The subject of the e-mail is Test Notification. The e-mail message contains the sentence, "This is a test of notification via e-mail."
USE msdb ; GO EXEC dbo.sp_notify_operator @profile_name = N'AdventureWorks Administrator', @name = N'François Ajenstat', @subject = N'Test Notification', @body = N'This is a test of notification via e-mail.' ; GO


Note