Sql-server – Resume job ‘A’ at some step till job ‘B’ is completed

sql serversql-server-agent

I have two SQL Agent jobs 'A' and 'B'
Job 'A' has 10 Steps and it starts at 5:00 Am as per schedule,
job 'B' has 5 Steps and it Starts by using trigger in step 3 of job 'A',
job 'B' should be Completed before starting of step 8 in job'A',
But sometimes Job 'B' is not completed when step 8 in job'A' starts.

So, my requirement is, i want to add one step before step 8 in that i want to check the status of job'B' when job'B' is completed then step 8 should start else it should not start and it should wait till job'B' completed

How can i achieve this?

Thank you.

Best Answer

You are using jobs incorrectly, the steps from job B should simply be in job A. Use stored procedures to group and reuse common code not jobs.

However it is possible to do this, in which case this is a duplicate of Good way to call multiple SQL Server Agent jobs sequentially from one main job?