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)
 Rounding Question

Author  Topic 

Bex
Aged Yak Warrior

580 Posts

Posted - 2008-09-26 : 11:32:59
I want to round a value down to the last penny and CONVERT to 2 decimal points:

2.048000 = 2.04
1.184000 = 1.18
2.760000 = 2.76
0.995000 = 0.99

I CONVERT the values to NUMERIC, and the values are rounded up:

SELECT CONVERT(NUMERIC (18,2),2.048000) = 2.05

How can I ensure the values are rounded DOWN?

Thanks

Hearty head pats

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-26 : 11:41:38
quote:
Originally posted by Bex

I want to round a value down to the last penny and CONVERT to 2 decimal points:

2.048000 = 2.04
1.184000 = 1.18
2.760000 = 2.76
0.995000 = 0.99

I CONVERT the values to NUMERIC, and the values are rounded up:

SELECT CONVERT(NUMERIC (18,2),2.048000) = 2.05

How can I ensure the values are rounded DOWN?

Thanks

Hearty head pats


What is your expected result?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-09-26 : 11:41:54
You mean you want to TRUNCATE the decimals?

SELECT ROUND(Col1, 2, 1)
FROM Table1



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2008-09-26 : 11:46:08
Thankyou. Exactly what I wanted!

Hearty head pats
Go to Top of Page
   

- Advertisement -