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 2008 Forums
 Transact-SQL (2008)
 custom rounding function

Author  Topic 

HenryFulmer
Posting Yak Master

110 Posts

Posted - 2011-05-10 : 17:45:18
I have price values that I would like to round to the second decimal:

100.12 -> 100.10
100.13 -> 100.15
100.17 -> 100.15
100.18 -> 100.20
etc.

I'm not sure how to approach this.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-05-10 : 17:51:08
Would this work for you?
select round(yourNumber*2,1)/2.0;
Go to Top of Page

HenryFulmer
Posting Yak Master

110 Posts

Posted - 2011-05-10 : 17:57:49
perfect! - Thank you
Go to Top of Page
   

- Advertisement -