GilaMonster (11/17/2011)
Ola L Martins-329921 (11/17/2011)
The "AND" operator will check against the date-columns seperately - not simultaneously which in the case with "BETWEEN".Using GREATER THAN and LESS THAN in the above question would actually return all the records.
BETWEEN is completely equivalent to a combination of <= and >=
SomeColumn BETWEEN @Var1 and @Var2 is exactly the same as SomeColumn >= @Var1 and SomeColumn <= @Var2. In fact, the SQL parser converts the BETWEEN into the <= and >= form during parsing (pre-execution)
I have seen this myth propagated from time to time (use lt and gt in lieu of between).
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events