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)
 Proper way to round decimal down

Author  Topic 

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-08-23 : 14:53:02
This should be a relativly easy question, but I can not find the easy answer.

If I have a Money Column, and my values are as follows

MoneyCol
---------
12.23590
1.299123
3.126600


I want my results to be

12.23000
1.29000
3.12000

what is the best way to achieve this?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-23 : 14:56:05
You mean you want to TRUNCATE the decimals?


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-23 : 14:56:25

declare @sample table (i money)

insert @sample
select 12.23590 union all
select 1.299123 union all
select 3.126600

select i, round(i, 2, 1) from @sample



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2007-08-23 : 14:59:43
Works perfect.

Thanks!
Go to Top of Page
   

- Advertisement -