SQL Agent Job wrapper

  • Hi ,

    I need to create one Job that calls two jobs , and the condition is once first Job successfully finish then only second Job should be called.

    Any help is appreciated to determine how to do that.

  • I use the following to run a weekly job on Monday from within a daily job. I only want the weekly job to run if the 1st step of the daily works.

    if DATEPART(weekday, GETDATE()) = 2

    EXEC sp_start_job @job_name = 'my weekly job '

    In your case, I think that you would have something like

    Step 1

    EXEC sp_start_job @job_name = ' your first job here'

    with an On Success Goto Next Step

    Step 2

    EXEC sp_start_job @job_name = ' your second job here'

    with an On Success Quit with Success

    hth

    😛

  • Thanks but below first step will only start first job and if it starts successfuly it will go to next step but my requirement is if first job completes successfully then it should go to next step.

    just looking some alternative otherwise i have to put first job all 10 steps in first step of new wrapper job and then all 11 steps of second job in second step of wrapper job 🙁

  • Just add PurpleLady's Step 2 above, as the last step of your first job.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

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

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