The Max datetime

  • Comments posted to this topic are about the item The Max datetime

  • Need a correction in the original question. It shouldn't be "datetime". It should be "smalldatetime", just to avoid confusion that seems to be leading to a rather large base of people selecting the incorrect answer.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • A datetime allows the time component to be 23:59:59.

    Because the question asks for the maximum time stored by a datetime value and not a smalldatetime, I believe a change to the question is required.

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com

    Follow me on
    Twitter: @sqltwins

  • Got confused between datetime and smalldatetime...!!! But easy question and a good learning.!!

    Thanks

  • This was removed by the editor as SPAM

  • Nakul Vachhrajani (8/16/2016)


    A datetime allows the time component to be 23:59:59.

    But it also allows the date component to be up to 9999-12-31, so none of the answers would be correct if you assumed that datetime was the type being tested. I agree, the question is poorly worded, but it's possible to figure out the author's intent fairly easily.

  • Like Paul pointed out, the question asks about the max of a datetime. Given the answers provided, it wasn't too hard to figure out. Sure, it's an inaccurate question, but how many inaccurate questions do we get from people in a day during work? 😛

  • I have to agree about the question wording (because we all like to whine from time to time). However, I did realize that the question was about SmallDateTime. I got it wrong because I forgot about the rounding for seconds. So, a re-learning experience and I'll take my punishment for the miss.

  • The wording " What's the maximum time that can be stored in SQL Server 2014?" got me. :angry:

    But logically speaking, isn't it the interval from zero to 2079-06-06 23:59:00

    the maximum value of the TIME in seconds that can be STORED in SS2014?

    They haven't it always easy, our authors of QotD... 😉 Thanks Steve, need more coffee...:-)

  • Like everyone has already noted, typo on the datetime; should be smalldatetime.

  • I played around with it a bit.

    I can stuff '20790606 23:59:29' into a smalldatetime variable and it comes back out as '20790606 23:59:00'

    If I put '20790606 23:59:30' into it then it errors.

  • Thank you for the post, Steve, good one.

    I see a small mistake.:-)

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Adding one more vote to the request for correction.

  • Sorry, corrected the question itself. Too used to writing "datetime".

  • I also don't use Datetime as it's not accurate enough. I use Date , Time & Datetime2 as these correspond to my other Database that I use ( DB2 ) which has Date , Time and Timestamp

Viewing 15 posts - 1 through 15 (of 15 total)

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