Home » Microsoft » 70-765 » Which stored procedure should you use?
You have Microsoft SQL Server on a Microsoft Azure virtual machine.
You create a SQL Server Agent job by using the following statement.
You need to send an email message if the job fails.
Which stored procedure should you use?
A. msdb.dbo.sp_update_alert
B. msdb.dbo.sp_add_jobstep
C. msdb.dbo.sp_add_notification
D. msdb.dbo.sp_help_alert
E. msdb.dbo.sp help jobactivity
Correct Answer: C
Explanation/Reference:
Explanation:
To notify an operator of job status through Transact-SQL.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
— 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’,
@operator_name = N’François Ajenstat’, @notification_method = 1 ;
GO
References: https://docs.microsoft.com/en-us/sql/ssms/agent/notify-an-operator-of-job-status?view=sql-server-2017