Hi All,
Can you help me to fix my select statement?
I'm trying to get the last status message of my jobs schedules, but I see
one it failed this morning and my query still showing succeeded.
Any ideas???
Thank you in advance
JFB
select v.originating_server, v.name, v.job_id, max(h.run_date),
max(h.run_time), max(h.message) as JobMessage
from msdb.dbo.sysjobs_view v
inner join msdb.dbo.sysjobactivity a
on v.job_id = a.job_id
inner join msdb.dbo.sysjobhistory h
on a.job_id = h.job_id
where v.enabled = 1 and h.step_id = 0
group by v.originating_server, v.name, v.job_id