Monday, January 19, 2015

Using "msdb.dbo.agent_datetime" to Simplify Working with sysjobhistory

Just learned about the undocumented msdb.dbo.agent_datetime() function. Where has this been all my life? It takes an 8 digit date and a 6-digit time and converts it to a DATETIME - quite a time-saver.

-- An example of where it's really handy. 
   select j.name
        , jh.run_date
        , jh.run_time
        , msdb.dbo.agent_datetime(jh.run_date, jh.run_time)   as 'RunDate'
        , jh.step_id
        , jh.step_name
        , jh.message
     from msdb.dbo.sysjobs         j
     join msdb.dbo.sysjobhistory   jh
       on j.job_id = jh.job_id
 order by msdb.dbo.agent_datetime(run_date, run_time) desc

Beats trying to work with those columns yourself... but remember it's undocumented.

8 comments:

Unknown said...

Amazing that this is the first time I've ever seen this function mentioned. Thank you!

nayon shaha said...

what is hypothyroidism, hypothyroidism is referred to as underactive thyroid. it happens while your thyroid gland does not make sufficient thyroid hormone. it manner you have got low thyroid interest. the thyroid gland is fashioned like a butterfly. it's miles positioned in the front of your neck, beneath your adam’s apple. the thyroid makes hormones that control how your body makes use of strength. it affects your coronary heart charge as well as your muscular tissues, bones, and other organs.

if you want more just look here "Health Topics"

farai sing said...

Many students think that the issue of racial discrimination is quite a common one, and a lot of relevant information can be found in different online resources, available to the public for free, so they’ll never encounter any troubles in doing an assigned task.

if you want more just look here "view"

ayon saha said...

We do not require our applicants to have managerial experience. However, if you would like to gain some, this position may be a perfect fit for you. The most promising applicants are invited to pass the Onboarding course, which is an educational resource for our new mentors.

if you want more just look here "learn more"

Alex Smith said...

How blockchain technology keeps data secure?

Within a permissioned blockchain transactions are validated and processed by participants that are already recognized by the ledger. Even though this is the case, there is still a challenge and issue of trust. How can one ensure the blockchain is secure and trustworthy in order to avoid the substantial impact of a cyberattack? The answer is by building security into your blockchain technology from the start, through strong authentication and cryptography key vaulting.

if you want more just look here: Crypto Currency Security

Judith Johnson said...

A course that helps you get in the know is one of the most useful parts of a course. solving homework is a much simpler part of learning because services like https://buypapercheap.net/ that presents the service that offers cheap essay writing cheap essay writing - can help cope with this part

lessonpros said...

Very informative and useful post. Please do visit my Online Violin Lessons and let me know your valuable comments.

findermt said...

Call Junk Car Buyer GA to sell a junk car for cash. We pick up and pay the same day. We buy wrecked cars even if it's a non running car or can't pass emission. Junk car buyers at your door-step with cash for your car within minutes; whether you are in Atlanta or Alpharetta, we will come to you

We pay the most cash for cars in Decatur GA regardless of condition or age. Running or not, we will pay top dollar for any car. Call us to get a quote, we'll pay and pick up the junk car today. Junk Car Buyer GA pays top dollar cars in Metro Atlanta and neighboring cities. Running or not, we will pay and pick it up. Call to get the most cash for your car. Same day pick up guaranteed!

read more here: car buyers

Post a Comment