O'Reilly logo
  • Dustin Waybright thinks this is interesting:

SELECT orderid, orderdate, empid, custid
FROM Sales.Orders
WHERE YEAR(orderdate) = 2007 AND MONTH(orderdate) = 2;

However, because here you apply manipulation to the filtered column, the predicate is not considered a search argument


Cover of Training Kit (Exam 70-461): Querying Microsoft® SQL Server® 2012


Though, if you are dealing with a datetime where the time is not midnight, filtering on date parts might be a solution to get all orders from a day. That, or using a literal that places the date as a range between 00:00:00 and 23:59:59