I have 2 columns in a table Start date and EndDate , i want to enter Current date and it should compare current date with start and end date if current date exist between start date or enddate must return that row. i have query but not good result found select * from Seasons where CONVERT (date, GETDATE()) between '@startdate' and '@Endate'
0
votes
3 Answers
0
votes
Please check whether the below code works for you.
if both the date (startdate and enddate) should match the current date then use this.
select * from Seasons where convert(date,startdate) = CONVERT (date, GETDATE()) and convert(date,Endate) = CONVERT (date, GETDATE())
if any one of the date (startdate or enddate) should match the current date then use this.
select * from Seasons where convert(date,startdate) = CONVERT (date, GETDATE()) or convert(date,Endate) = CONVERT (date, GETDATE())