2017-09-25 53 views

回答

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 = '[email protected]' 
           ,@subject = 'Column is NULL' 
           ,@body = 'The Column is currently NULL' 
相關問題