April 14, 2011 at 10:19 am
"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.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
April 16, 2011 at 9:27 pm
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
Change is inevitable... Change for the better is not.
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply