Update Last Run Outcome in SQL Server Jobs

  • We run a lot of SQL Server Jobs, but as they become not needed, we do not delete, but simply disable them and change the name so that all disabled jobs show together to make it easier to view.  However, there are times we need to see what jobs failed, so we sort Job Activity Monitor by "Last Run Outcome" column.  However, there are a lot of the "Disabled" jobs that still show as Failed, so they show when we sort by the "Last Run Outcome" column.

    To avoid this, was thinking of updating these jobs so that the "Last Run Outcome" shows as "Succeeded", so when we sort, we only see Active jobs that have failed.  Is there a way to manually update these jobs so that they show as "Succeeded"?

  • Select ....
    from msdb..sysjobhistory JH
    inner join msdb..sysjobs J
    on J.job_id = JH.job_id
    Where J.enabled = 1 -- only active jobs
    and JH.step_id = 0
    ....

    Keep in mind, you can launch disbled jobs as well  !

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • I mean no disrespect, but I know how to query the sys.jobs to find the data.  I just want to update the values so they appear differently in Job Activity Monitor.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply