22,207
社区成员
发帖
与我相关
我的任务
分享
select j.name as job_name,
js.step_name,
h.run_date,
h.run_time,
h.run_duration,
h.server,
case run_status
when 0 then '失败'
when 1 then '成功'
when 2 then '重试'
when 3 then '取消'
when 4 then '正在进行'
end as run_status
from msdb.dbo.sysjobhistory h
inner join msdb.dbo.sysjobs j
on h.job_id = j.job_id
inner join msdb.dbo.sysjobsteps js
on js.job_id = h.job_id
and js.step_id = h.step_id