It's better to do not use BETWEEN when dealing with DATETIME datatype. It's better to be like this:
SELECT SalesOrderID ,
OrderDate
FROM Sales.SalesOrderHeader
WHERE OrderDate >= '2008-07-01 00:00:00'
AND OrderDate <= '2008-07-15 00:00:00'
For more info, please see this link:
Bad habits to kick : mis-handling date / range queries
The most important motivation for the research work that resulted in the relational model was the objective of providing a sharp and clear boundary between the logical and physical aspects of database management. - E. F. Codd
Saeid Hasani's home page
No comments:
Post a Comment