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

23 comments:

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

Unknown 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!

Unknown 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

Unknown 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

Unknown said...

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

Sophie Grace said...

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.If you want to find idol's account on instagram, please visit instagram story viewer

Unknown said...

Online Betting in India

Online Games said...

There are a few things you can remember before selecting the right sportsbook for your betting style. First, check if the bookmaker is approved by one of the trusted agencies.
https://gervaisjervis9.wixsite.com/tooltech/post/betting-advice-and-cricket-match-forecasts-for-cricket

Online Games said...

Cricket betting india is one of the most sophisticated website that provides all kinds of betting tips that are free to access. That will not only help you right now but also beneficial in your long run.
https://collegeplus.itri.org.tw/forums/users/cricket_betting/

https://www.theartfulhomedomain.com/site/bestofbettingsites.com said...

I've read a few of the blog posts on your website now, and I really like your blogging style. I've saved it to my bookmark website list and will return soon. Please visit my website and let me know what you think.

https://www.cordylink.com/site/bestofbettingsites.com

https://www.cordylink.com/site/bestofbettingsites.com

Ashish said...

All of the safest betting websites have a license issued by a legit gambling commission and that’s the first thing we establish. The regulators run extensive background checks before they grant the necessary seal of approval and they continue monitoring their trusted bookmakers after that.
https://my-blogging-channel-15.webself.net/blog/2021/03/10/workings-of-licensed-online-cricket-betting-sites-in-india

Sean Martin said...

I've read a few of your blog posts now, and I really like your writing style. Your subject is fantastic and extremely beneficial to us. https://www.digi.com/support/forum/user/narantour

Ashish said...

betfair 365 is an online betting website that offers a variety of guidelines and free betting tips that prove to be very useful for people just entering betting. It is among the top websites for betting in India.
https://my.desktopnexus.com/Lookinindia123/

Ashish Mehta said...

famous female boxers are becoming the most significant way to practice betting and more people are joining online betting websites daily. These websites suit these online betters as they provide them with the best services.
https://www.teachertube.com/user/channel/muneercars123

Restaurants Menu and Guide said...

Thank you for providing such a wonderful website; it has been quite beneficial to me. Continue to write. Thank you kindly. I'm pleased to say that your post was a pleasure to read. I'm never going to stop talking about it. You're doing a fantastic job. https://www.behance.net/emailmarketing3

Unknown said...

Thank you for providing such a wonderful website; it has been quite beneficial to me. Continue to write. Thank you kindly. I'm pleased to say that your post was a pleasure to read. I'm never going to stop talking about it. You're doing a fantastic job. https://www.cybo.com/US-biz/mobile-windscreen


N.S Kehal said...

Looking for such informative post.
https://foldads.com/0/posts/3-Services/20-Financial/384098-Accountant-Surrey-BC.html

Unknown said...

I've read a few of your blog posts and really enjoy your your style. Your topic is wonderful and incredibly useful to us. https://www.bakespace.com/members/profile/summersale/1306652/

Ashish Mehta said...

Find online sweatshirts, Jogger sets and hoodies for kids and boys at a fair price. Free shipping available on Anthrilo
https://classifieds4free.biz/0/posts/5-For-Sale/35-Clothing-Shoes-Accessories/1732517-Online-Shopping-for-Kids.html

AWS Mortgages said...

We know that getting a large mortgage as a professional can be very challenging. The AWS Mortgages consulting system allows you to identify the pros and cons of various large mortgage Loans and the competitive interest rates offered by large mortgage lenders.
https://amazingviralmagzine.com/tips-for-choosing-a-mortgage-for-a-first-time-homebuyer/

N.S Kehal said...

Now invest your precious energy and time in doing administrative tasks as we outsource bookkeeping for small business firms that will help you in this regard. Find expert accounting outsourcing services for small businesses along with other services from us.
https://www.divephotoguide.com/user/kehalcpa

Ashish Mehta said...

Get out (dont stroll!) to discover the latest fashions in jeans for men. Explore boys joggers in an array of trendy colours, camo styles and cargo pants, too. The boys joggers we offer pair well with a basic shirt or the latest design he's is adoring!
https://www.scoop.it/topic/kids-clothes-by-anthrilo/p/4128310238/2021/11/18/girls-shorts-sets-anthrilo

Ashish Mehta said...

Remortgage to contractors involves the process of underwriting, registering, documenting, and providing information that can be complex and difficult for contractors. But with the advice of a specialised contractor remortgage's broker, this process will be done for you in the shortest possible time and with high quality. Meantime, access to contracts at favourable rates is one of the advantages of using a contractor remortgage's broker. AWS Mortgage specialist advisors are ready to help you with all the processes and documents required to get a mortgage again. AWS Mortgage advisors having experience in doing several cases will advise contractors from the beginning to the end.
https://articlescad.com/what-is-a-contractor-mortgage-broker-and-do-i-need-one-19983.html