Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling jobs from SP

Status
Not open for further replies.

Nowell

IS-IT--Management
Jan 2, 2003
245
GB
Hi,

I have a stored proc that calls two jobs, like so:

exec pelican.msdb.dbo.sp_start_job @job_name=
'restore = alpha pm'

exec pelican.msdb.dbo.sp_start_job @job_name=
'restore = Omega PM'

Will the second job wait for the first job to complete before it executes?
 
I do not beleive that it will wait on the first job executed to complete

Thanks

J. Kusch
 
Ok thanks,

Is there anyway I can make it do that, basically I want the restores to run:

a. once the backup has completed
b. second restore to run after the first one has completed as they will be using the same file.

thanks mate
 
May want to wrap both of those jobs into just one job. Each backup/restore as a single step. You can the set the job to fail and stop running if one step does not complete and to continue if all is fine.

Thanks

J. Kusch
 
You could also have the job log completion to a table and wait on that or query msdb..sysjobhistory for completion

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Hi,

How about if I call the first job from the stored proc, then call the second job from the store proc in the first job, will that work ok?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top