SQL Agent Jobs - Go To Step specified

  • Hi

    I have a job which has 5 steps.

    Step4: It is a procedure which checks for a few conditions. Based on the an output parameter value returned from the procedure, I need to go to either Step5 or Step2 and start from that step again.

    Is there any way I can do that? Please suggest.

    Thanks and Regards,

    Praveena.

  • Yes it can be done, but it's risky and this is not really the place to do loops like this. I would advise you build this sort of process into SSIS where you have much better logic handeling and bracnching/looping control.

    I have done this by doing a test and returning an error if the condition to loop back was met, then use the On Error option to loop back. The risk is if you get a legitiamate error you have lost this control.

    THe right tool for this is SSIS.

    Cheers

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • Hi Leo,

    I used SSIS. Thank you for the reply.

    Best Regards,

    Praveena

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

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