Job Scheduling base on another job completing

  • Is there a way to schedule a sql agent job to run after another sql agent job has successfully completed? For instance I don't want some jobs to run until after the backup job completes. Without having to look at the history and make an educated guess for when to schedule the other jobs is there a way to create the job to not begin until the backup completes?

    Thanks

    Sherri

  • I can think of 2 ways off the top of my head, but the easiest ways are not to set seperate SQL Agent jobs.

    1. Create a Maintenance Plan and have the tasks proceede one another and use the flow arrows to ensure that one task completes before the next begins. For expample create one subplan and have an integrity check that leads into a full backup

    2. Set them as multiple steps of the same SQL Agent job, under Steps | Advanced make sure the On Success is set to Go To Next Step

  • I did this a lot. Just add a step on the job that you want to completed first.

    this step will kick off the new job

    EXEC msdb.dbo.sp_start_job N'new job name';

  • Thank you. I will try both and see which one I like setting up better since it will be a common thing on several of my servers.

    I don't know why I didn't think to make them separate steps in the same job.

    Thanks again.

    Sherri

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply