SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Check Jobs Current State

By GabeGreen, 2002/01/03

Total article views: 897 | Views in the last 30 days: 9

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

By GabeGreen, 2002/01/03

Total article views: 897 | Views in the last 30 days: 9
Your response
 
 
Related tags
 
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com