Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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)

Job Run Duration

By neder,

This script gives you an idea on how long the processing time is for your SQL jobs. It will depend on how many records are being retained on the sysjobhistory table (scripts defaults to the last 30 days--may not find any history at all).
One may find it useful when there are so many sql jobs and need to find some stats. More useful when combined with List SQL Server Jobs scripts.

Below are the returned column with a little explanation:
  Job Name    --  Name of the Scheduled Job
  Last_RunDate -- Last execution datetime
  Last_RunStatus -- status for the last run
  Last_RunDuration -- format is hh:mm:ss
  Avg Duration -- average exec time; format in hh:mm:ss
  Max Duration -- maximum exec time; format in hh:mm:ss
  Min Duration -- minimum exec time; format in hh:mm:ss
  From Date    -- oldest job run sampled
  Sampling     -- number of job history collected (run
                  status doesnt matter)

Total article views: 1335 | Views in the last 30 days: 67
 
Related Articles
SCRIPT

Script to Check the Database Backup duration

Script to Check the Database Backup duration of entire instances

ARTICLE

Working with SQL Agent Durations

SQL Agent stores duration in HHMMSS format - not always useful. Discover how to use Powershell, some...

FORUM

Time Duration Addition

Adding Time Duration in SQL

FORUM

Last executed query total duration

Last executed query total duration

ARTICLE

Calculating Duration Using DATETIME Start and End Dates (SQL Spackle)

It's an old problem with a solution that's nearly as old. SQL Server MVP Jeff Moden shows us the ol...

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones