Skip to content
Advertisement

Trunc(sysdate) in SQL Server

What is the equivalent of:

TRUNC(SYSDATE) 

…in SQL Server 2005?

Advertisement

Answer

Recommended:

DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))

This is another alternative, but it’s risky because of casting to a FLOAT. It’s also been demonstrated to not scale performance as well as the DATEADD/DATEDIFF approach.

CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement