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)
 Round problem

Author  Topic 

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2012-01-11 : 03:24:13
Hello All Experts,

I have number like this:-

1.05
1.03
101.25
101.21

I want to round it as follow:-

1.05=1.10
1.03=1.00
101.25=101.30
101.21=101.20

Regards,
AKM

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-11 : 03:27:33
ROUND(field,1)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2012-01-11 : 03:32:51
quote:
Originally posted by visakh16

ROUND(field,1)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Thanks, But its not work in below scenario.

SELECT ROUND('100.05',1)

its give 100...which is incorrect..its should be 100.10
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-11 : 03:53:02
SELECT CAST('100.05' AS decimal(30,1))


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2012-01-11 : 03:56:56
Thanks Visakh :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-11 : 03:58:23
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -