Skip to content
Advertisement

Sql agent job last run status

I have N jobs with M steps in each, that could change any time(Add/delete some steps). Jobs have different schedule to run. I want a query to get last run status, job id, job name of each job. Is it right way to do this scenario by (Job outcome) ?

Advertisement

Answer

This is the query I use (a little tuned) to check job status. This variation will select the last job outcome for each job.

If you change the TOP 1 for TOP 2, then you will also see the last step executed, aside from the job outcome.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement