Date Time range

  • Learned something today....missed it though..

  • Great Question Daniel, had to run it in SSMS to understand and get it right.

    Learned something new.

  • Nice question. I got so caught up wondering why you chose union instead of union all that I missed the smalldatetime. doh!

  • Good Question, but i got it worng and learn new thing.

    Thx

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!

  • ...of course the real take-home message is that you're much better off avoiding BETWEEN when dealing with datetime (or smalldatetime (or floating point)) data.

    You can be sure you'll get what you intend to get if you instead write:

    WHERE TStamp >= '2011-05-12 09:00:00' AND TStamp < '2011-05-13 00:00:00'

    Edit:

    Dagnabbit! Weird HTML formatting got me again. That should say >= and <

    Don't know how to fix it though.

    ...One of the symptoms of an approaching nervous breakdown is the belief that ones work is terribly important.... Bertrand Russell

Viewing 5 posts - 16 through 19 (of 19 total)

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