Link to home
Start Free TrialLog in
Avatar of nummagumma2
nummagumma2Flag for United States of America

asked on

Check for running SQL job before starting new job

I have a SQL job that can take a variable length of time to run.  I have another job that runs on a closer schedule.  If the second job starts while the first is running, it will fail.   I'd like to have the second job check for the first job running, and then either WAIT or not run at all.

Ideas?
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Why not add the steps from Job 2 to Job 1?
the convenient solution has offered by BrandonGalde. Use it..
Avatar of nummagumma2

ASKER

Sorry folks - my question wasn't clear enough.

Job1 runs once a day and can take 30 minutes to 3 hours.
Job 2 runs every 2 hours and can take 5 minutes to 30 minutes.

If they collide, there's a problem.  They both need to run independently of each other.

I'd like to have Job2 check to see if Job1 is running, and if so, then WAIT and/or fail that specific instance.  I hope that clears up what I'm trying to achieve
ASKER CERTIFIED SOLUTION
Avatar of D B
D B
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial