Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Unanswered: Job still runs when disabled

    I have a requirement that if a recurring job fails it should disable itself so it does not run again until the problem is fixed. To test this I created a simple job that has 1 step that runs a proc that updates the sysjobs table in msdb. The job is scheduled to run every 2 minutes. When I check sysjobs the job shows as disabled (enabled = 0) if I refresh the Jobs list in management studio it has the little red disabled icon, but the job continues running.
    If I open the job in SSMS and tick the enable check box and save then re-open it and un-tick it and save, the job stops running. I have looked at the tables before and after and I can't see a difference in when I disable in a script or disable using the UI.
    Does anyone know what piece I am missing here?

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Instead of directly updating the sysjobs table, you should probably run msdb..sp_update_job.

  3. #3
    Join Date
    Nov 2011
    Posts
    2
    Thanks, that did the trick.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •