Get the jobs details in sql server and their status


Hi All,
Please use the below script in the Sql server management studio to see the status of Jobs running on Sql server instance

Use msdb

go

select distinct j.Name as "Job Name", j.description as "Job Description", h.run_date as LastStatusDate,

case h.run_status

when 0 then ‘Failed’

when 1 then ‘Successful’

when 3 then ‘Cancelled’

when 4 then ‘In Progress’

end as JobStatus

from sysJobHistory h, sysJobs j

where j.job_id = h.job_id and h.run_date =

(select max(hi.run_date) from sysJobHistory hi where h.job_id = hi.job_id)

order by 1

Please let us know if you have other options

Thanks for viewing.

Regards,

Chaitanya

https://mssqlbuzz.wordpress.com/

Leave a comment

Design a site like this with WordPress.com
Get started