HiTrying to search a table which has a datatype of "SMALLDATETIME". Data in the field, of course, is in following format:2005-06-07 00:00:00 or YYYY-MM-DD HH:MM:SSI only need to search the date part with no consideration for the time part.I am getting very inconsistent and inaccurate results. Mostly, the results returned are outside the date span. I have also tried altering the BETWEEN format, i.e., replacing "/" with "-", full year instead of 2-digit year, etcEDIT: I have also tried the CONVERT statement in the SELECT clause OR in the WHERE clause AND have tried the CONVERT in both the SELECT and WHERE clause with no difference in result set.I have tried the following sql syntax without consistent or accurate results:SELECT CONVERT(VARCHAR(11),DateField,101),c_number, cc_summary.prdkey.?FROM cc_summary INNER JOIN P_HEADER ON CC_Summary.PrdKey =P_HEADER.PrdKeyWHERE CC_Summary.DateField BETWEEN '01/01/15' AND '03/30/15'AND P_HEADER.Status <> '0'AND cc_summary.ID = '033'?
Any help would be greatly appreciated.SQL Server version 2008 SP1Windows server 2012