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 2000 Forums
 Transact-SQL (2000)
 ROUND FUNCTION

Author  Topic 

real_pearl
Posting Yak Master

106 Posts

Posted - 2004-06-29 : 07:03:19
When I use round function

select round(1234.54656, 2)

it rounds the value to 1234.55000, while I want it to truncate to two decimal portions too. But it doesn't do this, for this I use

select convert(numeric(18,2), 1234.54656). It does this, but sometimes in query analyzer it also does not produce proper results. I want to know the proper way of rounding to 2 decimals

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-06-29 : 08:26:49
Whats wrong with

Select convert(numeric(18,2), round(1234.54656,2))

Corey
Go to Top of Page

vganesh76
Yak Posting Veteran

64 Posts

Posted - 2004-06-30 : 10:41:50
U could avoid rounding when u converting to numeric value
select convert( numeric(18,2), 1234.54656 )


Ganesh

Enjoy working
Go to Top of Page
   

- Advertisement -