Skip to content

Commit

Permalink
Step ID and Name bug fix + script rename
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyBruk committed Jan 14, 2025
1 parent 9446131 commit b9da6b6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ FailedSteps AS
(
SELECT
j.name AS job_name,
h.step_id,
h.step_name,
js.step_id,
js.step_name,
h.run_date,
h.run_time,
h.run_duration,
h.message
h.[message]
FROM
sysjobhistory h
INNER JOIN sysjobs j ON h.job_id = j.job_id
msdb.dbo.sysjobhistory h
INNER JOIN msdb.dbo.sysjobs j ON h.job_id = j.job_id
LEFT JOIN msdb.dbo.sysjobsteps AS js ON j.job_id = js.job_id
INNER JOIN RecentJobExecutions r ON h.instance_id = r.instance_id
WHERE
h.run_status = 0 -- Step failure
Expand All @@ -50,8 +51,7 @@ SELECT
job_name,
step_id,
step_name,
run_date,
run_time,
msdb.dbo.agent_datetime([run_date],[run_time]) AS run_datetime,
run_duration,
[message]
FROM
Expand Down

0 comments on commit b9da6b6

Please sign in to comment.