Monday, March 17, 2008

SQL Server Agent Jobs duration Report

Hi folks. I would like to share with you the following simple script to show us jobs duration report in SQL Server 2005. I manipulated with INTERGER values stored by SQL Server to convert them into DATETIME/CHAR(8) datatypes to represent the data.
Thanks to SQL Server MVP Peter Ward provided me with StartTime calculation.

WITH job_duration_view
AS
(
SELECT name,
StartTime = CONVERT(DATETIME, RTRIM(last_run_date)) +
(last_run_time * 9 + last_run_time % 10000 * 6 + last_run_time % 100 * 10 + 25 * last_run_duration) / 216e4 ,
CONVERT(CHAR(8),DATEADD(ss,last_run_duration,CAST(last_run_date AS CHAR(8))),114)
AS duration
FROM msdb.dbo.sysjobservers js
JOIN msdb.dbo.sysjobs j ON j.job_id = js.job_id
WHERE last_run_date >0 AND last_run_time >0
) SELECT name AS job_name,StartTime,
StartTime -'19000101'+Duration AS EndDate ,Duration
FROM job_duration_view

15 comments:

barb michelen said...

Hello I just entered before I have to leave to the airport, it's been very nice to meet you, if you want here is the site I told you about where I type some stuff and make good money (I work from home): here it is

Cynthia said...

I would like to become a SQL Developer. What would be one of the first steps I would need to do in pursuing this as a career? I do not know SQL programming very well.

xiaoqiu said...

Delivering a new dimension for hardcore Maple Story players with the addition of a fourth job and some free maple mesos, this is launched today. Maple Story players will have reached a high enough level to achieve the 4th Job or some necessary maplestory mesos, which begins this week. Many people can cost their own cheap mesos to gain themed dessert and costumes among their many posts. The addition of the 4th Job provides further depth to an already intricate and complex maple story mesos in game. At Leafre, players can find new upgrades for some of the games more powerful weapons can receive from mesos and also party with other elite players.

products said...

China Wholesale has been described as the world’s factory. This phenomenom is typified by the rise ofbusiness. Incredible range of products available with China Wholesalers “Low Price and High Quality” not only reaches directly to their target clients worldwide but also ensures that wholesale from china from China means margins you cannot find elsewhere and buy products wholesaleChina Wholesale will skyroket your profits.wedding dressescheap naruto cosplayanime cosplay

products said...

Women’s nike tn Shox Rivalry est le modèle féminin le plus tendance de baskets pour le sport. tn chaussuresConcernant la semelle :spyder jacketsCheap Brand Jeans Shop - True Religion Jeans cheap nike shox & Puma Shoes Online- tn nike,Diesel Jeans le caoutchouc extérieur, l’EVA intermédiaire Levis Jeanset le textile intérieur s’associent pour attribuer à la.ed hardy shirts pretty fitCharlestoncheap columbia jackets. turned a pair of double plays to do the trick.Lacoste Polo Shirts, puma basket, Burberry Polo Shirts.wholesale Lacoste polo shirts and cheap polo shirtswith great price.Thank you so much!!cheap polo shirts men'ssweate,gillette mach3 razor bladesfor men.As for Cheap Evisu JeansCheap Armani Jeanspolo shirtsPuma shoes

men's clothing said...

I feel honored and privileged after reading your posts.You know,summer is coming!
hommes chaussures
Chaussures Homme Nike,hommes chaussures pas cher.fashionable homme chaussure,Best wishes to you!
Acheter hommes chaussures in our shop

aiya said...

Office 2010is powerful!
Microsoft Office 2010is the best software in the world.
Microsoft wordis so great!
Office 2007makes life great!
Many people likeMicrosoft Office.
Microsoft Office 2007is welcomed by the whole world.
Office 2007 keyis available here.
Office 2007 downloadis on sale now!
Office 2007 Professionalbring me so much convenience.
Outlook 2010 make life wonderful!
Microsoft outlook is my love.
Microsoft outlook 2010 is convenient!
Windows 7 is convenient!

job tardis said...

Nice news and thanks for sharing this here to let me know this updates,please know the recent updates by visiting this link also…because I had gain some info from here also: SQL Server Jobs

maria ishfaq said...

looking for jobs?? Visit this site.. It might help
Jobs

Frozen Juegos said...

This is a great article. It gave me a lot of useful information. thank you very much.
Signature:
Jugar juegos de frozen en línea gratis, los nuevos de princesa de Disney juego frozen - la princesa encantadora y linda. Divertirse frozen!

Facebook Descargar said...

Thank you for that information you article.
Signature:
download descargar facebook gratis para Android celular and download free descargar facebook apk en español, descargar facebook plus , descarga facebook

Whatsapp Descargar said...

Great info. I love all the posts, I really enjoyed, I would like more information about this, because it is very nice., Thanks for sharing.
Signature:
download free descargar whatsapp gratis and download baixar whatsapp gratis online and descargar whatsapp , baixar whatsapp

Anh Mai said...

I understand what you bring it very meaningful and useful, thanks.
Signature:
Versión en facebook en español descargar a los países hablan Español: facebook entrar direto agora , facebook en español para and facebook entrar direto

games unblocked said...

great article, I was very impressed about it, wish you would have stayed next share
kids games online
friv 2
unblocked games 77
juego de un show mas

Mít Trang said...

You topic is very great and useful for us…thank you
juegosjuegos.com
juegos de matar zombies
jogos do friv