Actually i've not used the like operator for searching since it tales timepart also. The easy way to search for a record using datepart from the datetime field is as:
SELECT *
FROM my_sales
WHERE DATEPART(yy, date) = 2013
AND DATEPART(mm, date) = 08
AND DATEPART(dd, date) = 29)
I find this way easy to read, as it ignores the time component, and you don't have to use the next day's date to restrict your selection.
SELECT *
FROM my_sales
WHERE DATEPART(yy, date) = 2013
AND DATEPART(mm, date) = 08
AND DATEPART(dd, date) = 29)
I find this way easy to read, as it ignores the time component, and you don't have to use the next day's date to restrict your selection.