SQL Clone
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)

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: 2318 | Views in the last 30 days: 5
Related Articles

Script to Check the Database Backup duration

Script to Check the Database Backup duration of entire instances


Formatting Durations in SSAS: Caveat

I recently published an article on MSSQLTips.com titled Format Durations in SQL Server Analysis Serv...


Working with SQL Agent Durations

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


Time Duration Addition

Adding Time Duration in SQL


Last executed query total duration

Last executed query total duration