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 up values

Author  Topic 

zion99
Posting Yak Master

141 Posts

Posted - 2009-10-27 : 00:54:31
Hi,

I get values as shown in column 'val'. i need to display values as shown in column 'required'.


declare @tb1 table
(
val float
,required varchar(255)
)

insert into @tb1
select 1,'1' union all
select 1.12345,'1.12' union all
select 1.12684,'1.13' union all
select 1.1,'1.1'


select * from @tb1


is there any way i can know what is the length of numbers after decimal so that i can get data as shown in the column 'required'?

sanoj_av
Posting Yak Master

118 Posts

Posted - 2009-10-27 : 01:20:30
Select ROUND(val,2) from @tb1
Go to Top of Page
   

- Advertisement -