Getting the current date in SQL Server?
This question already has an answer here:
How do I get just the date when using MSSQL GetDate()? [duplicate]
2 Solutions collect form web for “Getting the current date in SQL Server?”
SELECT CAST(GETDATE() AS DATE)
Returns the current date with the time part removed.
DATETIMEs are not “stored in the following format”. They are stored in a binary format.
SELECT CAST(GETDATE() AS BINARY(8))
The display format in the question is independent of storage.
Formatting into a particular display format should be done by your application.
As you are using SQL Server 2008, go with Martin’s answer.
If you find yourself needing to do it in SQL Server 2005 where you don’t have access to the
Date column type, I’d use:
SELECT DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()), 0)