Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Check Jobs Current State

By GabeGreen,

I created this script in an attempt to better automate many different jobs that run each morning, as part of a datawarehouse build. I use it to not only tell me what jobs are currently running (so that I can manage how many I would like to run at a time), but what happened to the job after it completed (or not). The parameters are: @jobs = Comma seperated list of jobs to check @is_running = Should the procedure wait until the job indicates that it is "running" or not. @max_seconds = How long should the procedure wait for the job to indicate whether it is "running" or not. @pause_seconds = Controls the interval of time between job status checks. @retrying_equals_running = Should a "retrying" state be considered as "running" The procedure returns the job status as an integer that indicates the following: 1 - successfull 2 - retrying 3 - cancelled -1 - not started -2 - executing 0 - failed If anyone is interested, I can post the scheduling procedure as well... I'll wait to see the ratings that this script gets. Gabe Green

Total article views: 1222 | Views in the last 30 days: 3
Related Articles

SSIS Flat File read error retry?

How to retry a locked file?


WaitForChildren: Children persisting. Retry

Cannot kill the spid relating to the log entry WaitForChildren: Children persisting. Retry


SQL Agent Job-Retry

Dear all, we have sql agent job,the job is schedule everyday @9.30 A.M and @5.30 P.M. @9.30 sc...


Configuring Auto-Retry on SQL Server Agent

The goal of this post is to explain how to take advantage of Auto-Retry and why you will want to...


Indicator Rendering problem

Adding an indicator displays a blank box