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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Job execution based on Condition

Status
Not open for further replies.
Oct 17, 2006
227
HI


My datawarehouse is broken split into two Jobs. I have set a simple schedule for the first part on a daily basis but would like to make the second part run based on events where the Second part second step will only run if the first part is finished.

Is this possible?


Many thanks

Robert
 
The easiest way is to have the first job start the second job via the sp_startjob procedure within the msdb database.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Hi

I had originally though about doing that but the problem is that the second part can't start until after 7am could this be included within the condition?

 
Add a new first step in the job which says something like this.

Code:
if datepart(hh, getdate()) > 7
   waitfor time '07:00:00'

This way if the job starts before 7 it will wait until 7. If it starts after 7 it will simply continue on.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top