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 2005 Forums
 Transact-SQL (2005)
 Reset time part in datetime field to 00:00:00.000

Author  Topic 

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2013-02-04 : 00:23:03
I have a database column with datetime field

2012-07-20 08:00:00.000
2012-09-13 00:00:00.000
2012-07-23 01:00:00.000

What i wnated to do is set all rows time to be 00:00:00.000 like second row

I am using sql server 2005

Kamran Shahid
Principle Engineer Development
(MCSD.Net,MCPD.net)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-04 : 00:25:41
DATEADD(dd,DATEDIFF(dd,0,datefield),0)

see

http://visakhm.blogspot.com/2012/07/generate-datetime-values-from-integers.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2013-02-04 : 00:41:06
thanks visakh16

Kamran Shahid
Principle Engineer Development
(MCSD.Net,MCPD.net)

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-04 : 00:43:08
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -