September 2, 2009 at 3:40 am
Hi,
Small requirement!
-- Rounding to 1 decimal place
create table test01
(id float
)
truncate table test01
insert into test01
SELECT 21.6216216216216
UNION ALL
SELECT 18.3783783783784
union all
select 51.0371780739553
-- i would like to round to 1 ,decimal place
-- Case : consider 3 rd record
select ID,
ROUND(convert(float,id),1)
from test01
/* Output
21.621621621621621.6
18.378378378378418.4
51.037178073955351
*/
/*Required my Output
21.621621621621621.6
18.378378378378418.4
51.037178073955351.0
*/
Thanks in advance
September 2, 2009 at 4:24 am
Hi,
Try using numeric datatype.
As-
select ID,
ROUND(convert(numeric(18,1),id),1)
from test01
Good Luck
September 2, 2009 at 4:31 am
Thanks 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply