March 4, 2015 at 11:33 am
I have a number of jobs written which I would like to keep that way as sometimes I need to run them manually. However most of the time I want to have a job which executes them all in a certain order. However if I set these job going using EXEC [msdb]..sp_Start_Job it sees starting the job as being successful so fires the next job immediately. However the next job relies on the previous job being completed so my data warehouse build falls down. Any ideas without creating another job with all the steps from my 6 jobs in it ?
March 4, 2015 at 3:01 pm
The initiating job is going to have to start the first job, then wait until that job finishes, then start the next job, etc..
You could set up full messages using brokering, etc., but to keep it simple, I'd just:
have each job delay (n) minutes (WAITFOR DELAY ...), check for the job having completed, if not, wait again, etc., until each job finishes.
You can use msdb.dbo.sysjobhistory, step_id 0 written for the job, to see when a job finishes. Naturally you'd need to check date and time to make sure it was the most recent completion.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 4, 2015 at 3:02 pm
Removed, duplicate.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
March 4, 2015 at 3:02 pm
Removed, duplicate post.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply