I have one job on SQL server Job Agent that has 3 steps. I want to the job to run starting with step one. After step one is complete and only when it completes I want step 2 to start running and so for step 3
migrated from stackoverflow.com Jul 2 at 20:40
This question came from our site for professional and enthusiast programmers.
closed as unclear what you're asking by Mark Storey-Smith, Nick Chammas, Paul White, swasheck, dezso Jul 3 at 16:51
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking.If this question can be reworded to fit the rules in the help center, please edit the question.
The default in SQL Server Agent jobs is to run the steps sequentially. Step two will start only after Step one has completed etc. Although under the advanced settings you can change it to go from Step 1 to Step 3 and skip Step 2. In fact the only way I know of to avoid this is to create three separate jobs and have them all run at the same time.
EDIT: Here is an example of what the steps look like by default. Note that on successful completion each job goes to the next step.
And here is an example where the default has changed. Note that step one goes directly to step three and step two will never be run.
I should probably note that if the task the step is performing is asynchronous then the step will "end" and start the next step after launching the asynchronous task without waiting for that task to complete. Examples would be using a service broker or starting another job. In those cases I know of no way to force the agent to wait until the asynchronous task has been completed before starting the next step.