How can I strip the time from datetime field without converting to Char or
Vchar?You can't. DATETIME and SMALLDATETIME always store both date and time.
What you can do is set the time to midnight. For example:
SELECT DATEADD(DAY,DATEDIFF(DAY,0,CURRENT_TIMES
TAMP),0)
David Portas
SQL Server MVP
--|||Date already exists so I am not sure how to utlize
SELECT DATEADD(DAY,DATEDIFF(DAY,0,CURRENT_TIMES
TAMP),0)
to the existing date field.
"David Portas" wrote:
> You can't. DATETIME and SMALLDATETIME always store both date and time.
> What you can do is set the time to midnight. For example:
> SELECT DATEADD(DAY,DATEDIFF(DAY,0,CURRENT_TIMES
TAMP),0)
> --
> David Portas
> SQL Server MVP
> --
>
>
No comments:
Post a Comment