datetime => how to have complete date with 00:00:00.000

  • "Didactic" - as in instructive? Do you mean that those people using between should receive instruction before doing so? 🙂

    BETWEEN works fine as long as you know what you're doing ... But using >=, <=, > and < is more explicit, I'll agree.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • The only time BETWEEN works fine with dates is when you have whole dates with no times. Since BETWEEN is inclusive of both operands, you have to be real careful about using it with dates that have times lest you include some data you didn't mean to. For example, some folks mistakenly use the following to find all dates rows on SomeDate where SomeDate is a "whole" date...

    WHERE BETWEEN SomeDate AND DATEADD(dd,1,SomeDate)

    The problem with that is that Midnight of the next day is included because of BETWEEN.

    --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)

Viewing 2 posts - 16 through 16 (of 16 total)

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