sql job prevent concurrency between jobs

Have you ever needed to make absolutely sure two jobs dont run at the same time in, just schedule to run at different times i hear you say. well in some cases its not that easy. Sometimes you have jobs that run every 20 minutes and others of a similar fashion, there is a chance one job could extend longer for what ever reason, most of the time its unforseen, as in the case i had recently.
So i came up with a solution. A simple Stored Procedure i wrote can, it will live in your master db, why the master i hear you ask. well in order to prevent collasions between databases it is best to live in the master.
1st write a list of the job names you want to prevent from running concurrently, and then follow the instructions here
2nd place a code snippet only once, in the first step of each job, so it runs prior to anything in the job

Leave a Reply

Your email address will not be published. Required fields are marked *