From: David C on
I have a SQL 2000 database table that has a smalldatetime column that I want
to remove the time portion for those that have a time. We added a new
application that is "feeding" this table and the column named DateEntered
has both date and time in it. For example one of the entries is 11/3/2009
7:24:00 AM and we would like it to contain 11/3/2009 only, just like the
remainder of the table records. Any way to do this? Thanks.
Below is sample of update code

UPDATE dbo.ROTimesheets
SET DateEntered = LEFT(CONVERT(CHAR(10),DateEntered,101),10)
WHERE LEN(DateEntered) > 10

David


From: Uri Dimant on
David
UPDATE dbo.ROTimesheets
SET DateEntered = DATEADD(d,DATEDIFF(d,0,DateEntered),0)





"David C" <dlchase(a)lifetimeinc.com> wrote in message
news:OKmsVRWXKHA.1268(a)TK2MSFTNGP04.phx.gbl...
>I have a SQL 2000 database table that has a smalldatetime column that I
>want to remove the time portion for those that have a time. We added a new
>application that is "feeding" this table and the column named DateEntered
>has both date and time in it. For example one of the entries is 11/3/2009
>7:24:00 AM and we would like it to contain 11/3/2009 only, just like the
>remainder of the table records. Any way to do this? Thanks.
> Below is sample of update code
>
> UPDATE dbo.ROTimesheets
> SET DateEntered = LEFT(CONVERT(CHAR(10),DateEntered,101),10)
> WHERE LEN(DateEntered) > 10
>
> David
>