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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 rounding 100th second to 10th second
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

61 Posts

Posted - 04/03/2013 :  11:38:52  Show Profile  Reply with Quote
I have a datetime field in a table

2008-10-21 19:59:14.817

i want to round these entries to nearest 10ths of seconds so

2008-10-21 19:59:14.817 would become 2008-10-21 19:59:14.810

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 04/03/2013 :  12:41:48  Show Profile  Reply with Quote
Based on your example it looks like you want to TRUNCATE (rather than round) to the nearest 100th of a second (rather than 10th of a second)
You have to be using datetime and not smalldatetime, of course.
Go to Top of Page

Yak Posting Veteran

61 Posts

Posted - 04/04/2013 :  04:13:57  Show Profile  Reply with Quote
Thanks James

yes i want to remove the ms, and your solution works. out of interest can you round up or down based on the ms?
Go to Top of Page

Flowing Fount of Yak Knowledge

2242 Posts

Posted - 04/04/2013 :  04:52:42  Show Profile  Reply with Quote
Refer this link
Go to Top of Page
  Previous Topic Topic Next 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.04 seconds. Powered By: Snitz Forums 2000