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.

Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Scott Pletcher

8/22/2022 - Mon

Why not add the steps from Job 2 to Job 1?

the convenient solution has offered by BrandonGalde. Use it..

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.