DATETIME 2

  • Comments posted to this topic are about the item DATETIME 2

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Thanks Ron... I love questions that make me think.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • Thanks, great question.

    I first thought: "statement 1 doesn't return a row at all!" Then I read the question a little better 😀

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

  • Excellent question Ron. I had to run the code through to understand what it was doing and learned something new.

  • Wonderful question!

    Such questions build your concepts...and keep you think while you solve them.

    Keep posting such questions 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • Hi,

    ??????????

    How can I choose an answer and there is statement that insert into D4 table. !!!!!!!!!!!!!!!!!!!!!!!!!!

    Thanks

  • Good question Ron,

    Thanks!

    -------------------------------------------------------------
    "It takes 15 minutes to learn the game and a lifetime to master"
    "Share your knowledge. It's a way to achieve immortality."

  • khelloufsofiane 6183 (8/2/2012)


    Hi,

    ??????????

    How can I choose an answer and there is statement that insert into D4 table. !!!!!!!!!!!!!!!!!!!!!!!!!!

    Thanks

    Read the question. Read it again. Read it again and now pay special attention to the sentence enclosed in brackets.

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

  • Nice question - should have read it closer as I misunderstood the insert part of the question...doh...coffee time.

  • Got me thinking - good question.

    Thanks

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Nice question.

    But 23:59:59.9999999 is rather easy to round to 100 microseconds, isn't it. So I'm surprised so many have it wrong.

    Tom

  • Excellent question. I honestly had to run the code to get the correct answer but got a lesson on datetime2.

  • I am rather surprised at the low percentage of correct answers.

    Correct answers: 37% (76)

    Incorrect answers: 63% (129)

    Total attempts: 205

    And the implications this could have to those designing a DB, and inadvertently or deliberately using different definitions for a date time object in different tables (based only on each individual table's requirements) and then, when selecting, wondering why Select statements using a join / case / where on a date column do not return the correct data.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Thanks for making me think... I had to sit there and keep reminding myself how the datetime2 values would round and then tried to keep two mental counts (statement 1 and statement 2) in my head as I did the rounding...

    🙂 glad I got it right, and glad I didn't have to use more than the fingers on one hand for each count 🙂



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • I'm really proud of me because instead of running the query, I went to SQL help to find out what where the 4 and 7 in the datetime2 declaration.

    I've learned something new in the correct way: putting attention, investigating, thinking and, only then, answering.;-)

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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