SQL Server date between LIKE
30,500
Solution 1
Try this :
"Select (listOfFields)
FROM TABLE
where CONVERT(VARCHAR(25), Your_DATE, 126) BETWEEN 'Start_date%' AND 'EndDate%'";
Solution 2
Try something like this
SELECT * from table
WHERE CONVERT(VARCHAR, DateField, 120) BETWEEN '2010%' AND '2012%'
Author by
GreenCat
try to learn everything..my philosophy is simple " from nothing is something"
Updated on November 17, 2020Comments
-
GreenCat over 3 years
Please help me how to insert
LIKE %
in date between. Example is:SELECT * FROM table WHERE Date BETWEEN '" & startDate & "%'" AND '" & endDate & "%'"
So in this code where i should put
LIKE
so that data will appear?example if i set like this
SELECT * FROM table WHERE Date LIKE '" & startDate & "%'"
it's working..
LIKE
meant read either startdate or %..for starting it will read %