Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Sql Jobs steps Expand / Collapse
Author
Message
Posted Wednesday, April 10, 2013 3:50 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 22, 2013 2:08 PM
Points: 19, Visits: 63
Hello I have a several SQL JObs I need to run in sequence. For some reason when I run a job which I already setup with all jobs I need is not running correctly.


And SQL Server is not waiting for the job to be completed before continuing to the next job.

How can I accomplish this?

Any help is appreciated!! thanks

Post #1441055
Posted Wednesday, April 10, 2013 4:00 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 9:11 PM
Points: 20,861, Visits: 32,887
Are you using sp_start_job to execute your jobs? If so, that procedure is asyncronous, meaning it returns immediately after starting the job and doesn't wait for it to complete.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1441059
Posted Thursday, April 11, 2013 7:58 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, April 22, 2013 2:08 PM
Points: 19, Visits: 63
Yes I am using the sp_start command. So which one should I use to wait until a job finish then start the next one...is there any way to do this?
Post #1441262
Posted Thursday, April 11, 2013 11:02 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 9:21 AM
Points: 1,991, Visits: 1,496
Is there a reason why you have it set up as multiple jobs instead of just one job with multiple steps? If there is, I'm mot saying it's the best way to do this, but could you "daisy chain" them? Remove your job that fires off all the jobs and leave your individual ones and just add a second step for each one.

I.E.

Job1
Step 1 - Do something
Step 2 - sp_start_job("Job2")

Job2
Step 1 - Do something else
Step 2 - sp_startjob("Job3)

etc...

You can also use sp_help_job to check the status of your jobs as well.




Everything is awesome!
Post #1441382
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse