as
select distinct a.name as '作业 名称',
case --会员等级 对应 tbl_infotype 和 tbl_subinfotype
when b.last_run_outcome = 0 then '失败'
when b.last_run_outcome = 2 then '取消'
else
'其他'
end as '作业 次运行 结果',
a.description as '对作业 描述',
b.last_outcome_message as '消息', b.last_run_date
as ' 次运行作业 日期', FLOOR(b.last_run_time / 3/600) as '小时',
FLOOR((b.last_run_time - FLOOR(b.last_run_time / 3600) * 3600) / 60) as '分钟', (b.last_run_duration/60) as '作业运行 持续时间--分钟'
from msdb.dbo.sysjobs a, msdb.dbo.sysjobservers b where b.job_id = a.job_id and a.enabled = 1
and floor(b.last_run_time/60)>600