What is the optimal way to compare dates in Microsoft SQL server?

前端 未结 4 1387
别跟我提以往
别跟我提以往 2020-12-25 11:27

I have a SQL datetime field in a very large table. It\'s indexed and needs to be queried.

The problem is that SQL always stores the time component (even

4条回答
  •  情歌与酒
    2020-12-25 12:08

    Get items when the date is between fromdate and toDate.

    where convert(date, fromdate, 103 ) <= '2016-07-26' and convert(date, toDate, 103) >= '2016-07-26'

提交回复
热议问题