How to query DATETIME field using only date in Microsoft SQL Server?

后端 未结 17 1996
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 06:31

I have a table TEST with a DATETIME field, like this:

ID NAME DATE
1 TESTING 2014-03-19 20:05:20.000
         


        
17条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 06:55

    you can try this

    select * from test where DATEADD(dd, 0, DATEDIFF(dd, 0, date)) = '03/19/2014';
    

提交回复
热议问题