run_duration in SQL Server system tables

Oopps! Upgrade your browser pretty please.Oopps! Upgrade your browser pretty please.

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.job_id 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.