Link to home
Start Free TrialLog in
Avatar of Endelm
Endelm

asked on

MSSQL 2005 - DateTime

Hi,

declare @date datetime
set @date = '2008-01-29 12:01:09.437'

How can I cast @date so it will not contain any time, only contain the date:
'2008-01-29'

Many thanks!!! :)
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dportas
dportas

In SQL Server 2005 there is no date-only data type.
In SQL Server 2008 you can use the DATE type.

If you just want to display a datetime value without a time then do that in your client application or presentation tier. SQL Server does not and cannot control the display formatting of a datetime value.