Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DateTime Question

Author  Topic 

BigRetina
Posting Yak Master

144 Posts

Posted - 2003-05-28 : 06:41:00
Salute...
How can i reset the time part in a date field?
for example I have the following record in a table :
EmployeeNo BirthDate
---------- ----------
520 15/6/1977 12:42:30

I want to make it :
520 15/6/1977 00:00:00
How can I do that?? in one statment??

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-05-28 : 06:46:38
You can do: convert(datetime, convert(varchar, birthdate, 112))

There's a better way too... Can't remember it at the mo :)

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-05-28 : 07:06:44

update table
set birthdate = dateadd(dd,datediff(dd,0,birthdate),0)

 


Jay White
{0}
Go to Top of Page
   

- Advertisement -