SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Reset time part in datetime field to 00:00:00.000
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kamii47
Constraint Violating Yak Guru

351 Posts

Posted - 02/04/2013 :  00:23:03  Show Profile  Reply with Quote
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

India
52249 Posts

Posted - 02/04/2013 :  00:25:41  Show Profile  Reply with Quote
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

351 Posts

Posted - 02/04/2013 :  00:41:06  Show Profile  Reply with Quote
thanks visakh16

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

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 02/04/2013 :  00:43:08  Show Profile  Reply with Quote
welcome

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000