Best approach to remove time part of datetime in SQL Server

前端 未结 23 1566
南旧
南旧 2020-11-21 22:51

Which method provides the best performance when removing the time portion from a datetime field in SQL Server?

a) select DATEADD(dd, DATEDIFF(dd, 0, getdate(         


        
23条回答
  •  隐瞒了意图╮
    2020-11-21 23:14

    See this question:
    How can I truncate a datetime in SQL Server?

    Whatever you do, don't use the string method. That's about the worst way you could do it.

提交回复
热议问题