Best way to compare dates without time in SQL Server

前端 未结 7 1125
半阙折子戏
半阙折子戏 2020-12-15 17:17
select * from sampleTable 
where CONVERT(VARCHAR(20),DateCreated,101) 
=     CONVERT(VARCHAR(20),CAST(\'Feb 15 2012  7:00:00:000PM\' AS DATETIME),101)
相关标签:
7条回答
  • 2020-12-15 18:02
    select * from sampleTable 
    where date_created ='20120215'
    

    This will also compare your column with the particular date without taking time into account

    0 讨论(0)
提交回复
热议问题