SQL Server Nation
For all of your SQL Server needs.
run_duration in SQL Server system tables

 

If you are interested in the run duration of the jobs on your SQL Server you would most likely query the system tables sysjobs and sysjobhistory from the msdb database in a manner similar to this:

select name

,enabled

,run_status

,run_date

,run_time

,run_duration

from msdb.dbo.sysjobs sj

join msdb.dbo.sysjobhistory sjh

 on sj.job_id = sjh. 


What is interesting (and yes, it could be misleading!) is that the run_duration is presented by the following formula:

(hours*10000) + (minutes*100) + seconds

The bottom line is: do NOT think that the run duration is converted to seconds. Here is an example: if a job has a duration of 102950, this means that the job executed in 10 hours, 29 minutes and 50 seconds.

 


Posted 26 Oct 2009 5:31 PM by Feodor Georgiev
Copyright SQL Server Nation 2009
Powered by Community Server (Non-Commercial Edition), by Telligent Systems