skipping steps from jobs

  • I have a job with almost 10 steps in it.

    I want to disable the steps as per my wish programatically.

    ex: if 1 have to disable step 3 then i will skip step 3 and after 2nd step 4th should execute. but problem is that, may be step 4 is also disabled earlier. So if step 3 is skipped then it should go to a step which is active.

    I know the procedure sp_update_job AND table sysjosteps but I am not sure to work on it.

    I dont want to use user interface. I would like to create a script for this.

  • Example:

    EXEC msdb.dbo.sp_update_jobstep @job_id='job_id from sysjobs',

    @step_id=2 ,

    @on_success_action=4,

    @on_success_step_id=8 -- set next step

    Full documentation here: http://msdn.microsoft.com/it-it/library/ms189827.aspx

    -- Gianluca Sartori

  • You can set "On Success action" and "On Failure action" for each job step

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

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