DATETIME - 4

  • L' Eomot Inversé (3/16/2013)


    Nice question, and fine explanation, but that bit about "59.005" seems to have come from a different than the rest. 😉

    I thought that part was weird too, made me think longer about the answer as though it was some kind of trick question, but then I decided to go with the answer that made more sense to me and got it right. =]

    Thanks for yet another fine question, Ron!

  • sknox (3/18/2013)


    I'm curious: What was the point of the cursor-like WHILE and incrementing the ID by 3? Just Obfuscation? Why didn't you just write the query as:

    SELECT ID AS 'Select number', DATETIMEFROMPARTS ([Year],M,D,H,Mi,S,Ms) AS 'Datetime'

    ,CAST(S AS CHAR(2)) + ':' + CAST(Ms AS CHAR(3)) AS 'Original seconds input'

    FROM #T

    I have the same question as sknox, except I might add an "order by" to his proposed query.

  • Nice question, I learnt something new today

  • Nice question. I've hit that precision issue before so I guessed correctly. I like that 2012 datefromparts function too.

  • Nice one... Thanks, Ron!

  • I missed it, but still a nice one... Thanks, Ron!

    Not all gray hairs are Dinosaurs!

  • Nice question and i learned about accuracy and 2012 function(DATETIMEFROMPARTS). I don't know how this accuracy will help me in production..

    What I feel is Instead of assigining values to all variables in seperate select statement,Either could have done it in single select or as shokx said straight away could written in one statement..

    --
    Dineshbabu
    Desire to learn new things..

  • Thanks for the question.

  • Great question, had to read it a few times.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I've been catching up with unanswered DATETIME... questions of late so this was an easy one.

  • Easy Points

  • Good question !!!

  • Thanks for this question. Good one. 🙂

  • Nice question and nice explanation

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • I didn't know that.

    Thanks. Learned again something !

Viewing 15 posts - 16 through 30 (of 30 total)

You must be logged in to reply to this topic. Login to reply