How to get record in between time range
I want 开发者_JS百科to fetch some result from table depending on time range so i did
SELECT * FROM TABLE where convert(varchar(10),CountryTime,108) between '15:00' and '16:00'
CountryTime- is of varchar type.. but iam not getting corect output plz suggets..
Try using the DATEPART function:
SELECT * FROM TABLE
where DATEPART(HOUR, CountryTime) IN (15, 16)
Use varchar(5) instead of varchar(8)
SELECT *
FROM TABLE
where convert(varchar(5),CountryTime,108) between '15:00' and '16:00'
精彩评论