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?
Microsoft SQL ServerSQL

Avatar of undefined
Last Comment
Scott Pletcher
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Why not add the steps from Job 2 to Job 1?
Avatar of tigin44
tigin44
Flag of Türkiye image

the convenient solution has offered by BrandonGalde. Use it..
Avatar of nummagumma2
nummagumma2
Flag of United States of America image

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo