sqlserver 监控自动化作业执行情况
ALTER procedure [dbo].[monitorJob] @name varchar(100) as begin declare @bd varchar(100) ; if exists( select * from ?msdb.dbo.sysjobhistory? where job_id in (select job_id from msdb.dbo.sysjobs where [name]=@name ) and run_date=convert(varchar,getdate(),112)? and run_status=0) begin set @bd='10.158.32.154 计划任务 '+@name+' 执行失败!' exec MaganerDB.dbo.[spSendMail] ?@from='dwchaoyue@163.com',? ? ? ? ? ? ? ? ? ? ?@to='v.dengwang@snda.com;lidenggao@snda.com', ? ? ? ? ? ? ? ? ? ?@bcc='',?-- 抄送 ? ? ? ? ? ? ? ? ? ?@subject='自动化任务失败',? ? ? ? ? ? ? ? ? ? ?@htmlBody=@bd, ? ? ? ? ? ? ? ? ? ?@addAttachment='' -- 附件 end? end? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |