Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server date between LIKE

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 %

like image 501
GreenCat Avatar asked Oct 17 '25 13:10

GreenCat


1 Answers

Try this :

"Select (listOfFields) 
 FROM TABLE
 where CONVERT(VARCHAR(25), Your_DATE, 126) BETWEEN 'Start_date%' AND 'EndDate%'";
like image 197
Ramandeep Singh Avatar answered Oct 19 '25 09:10

Ramandeep Singh