如何在SQL服务器中安排作业,当SQL作业发送电子邮件警报时,如果列'卷'在表'表1'是NULL吗?
答案 0 :(得分:0)
设置好Database Mail Profile后,您可以根据需要创建一个按照合适的时间表执行SQL Agent Job的预定sp_send_dbmail
。
例如:
declare @NullCheck nvarchar(100);
set @NullCheck = (select YourColumn from YouTable);
if @NullCheck is null
execute msdb.dbo.sp_send_dbmail @profile_name = 'YourDBMailProfileName'
,@recipients = 'YourEmail@Example.com'
,@subject = 'Column is NULL'
,@body = 'The Column is currently NULL'