Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Let me better explain. My first job executes every 15 minutes (top of the hour, 12:15, 12:30 and 12:45). It does this for every day of the week. I have a second job that runs at 1:30 AM on the first day of the month. This job only runs once a month.

I need to daisy chain job one with job two only on the last execution of a given month. Meaning, job one executes at 11:45 pm and executes for 3 hours, at that point I need job two to start.

Thanks in advance. RC

share|improve this question
    
Are you talking about the DBMS SQL Server? SQL is just a language. –  Colin 't Hart Feb 21 at 15:25
add comment

1 Answer 1

For SQL Server, you can specify On success action to go to the next step, only when the job step #1 is completed. There, use a date/time condition to execute the job#2

if (day(getdate()) = 1 and DATEPART(hh, GETDATE())= 1)
EXEC dbo.sp_start_job N'job#2'

enter image description here

enter image description here

share|improve this answer
    
Thanks Milena, I'm thinking of heading down this road however need some more recommendations please. My second job can only run once. My first job, step 1 runs every 15 minutes. However my second step can only run on the completion of the step 1 –  Rick Feb 21 at 17:48
    
Try to create a time condition for a specific period. Instead of if (day(getdate()) = 1 and DATEPART(hh, GETDATE())= 1), try if (day(getdate()) = 1 and CONVERT(VARCHAR(8),GETDATE(),108) > '1:01' and CONVERT(VARCHAR(8),GETDATE(),108) < '1:15'). That way, you'll have the second step executed only on the first day in a month, if the first step is completed between 1:01 and 1:15 –  Milena Petrovic Feb 22 at 21:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.