SELECT j.[name] AS JobName,
msdb.dbo.agent_datetime(run_date, run_time) AS RunDateTime,
j.[enabled],
h.step_id, h.step_name, h.sql_message_id, h.[message], h.run_duration
FROM msdb.dbo.sysjobs j
INNER JOIN msdb.dbo.sysjobhistory h ON j.job_id = h.job_id
WHERE j.[name] = 'Job Name'
AND h.run_status = 0 --Failed
AND msdb.dbo.agent_datetime(run_date, run_time) > '2023-02-07 00:00:00'
ORDER BY RunDateTime DESC
No comments:
Post a Comment