Symptom
- Results of using function ROUND seems to be not always as expected.
In this query one value seems to be rounded properly and the other one seems to be truncated, not rounded. Why ?
drop table if exists tbl;
--
create table tbl(clmn double);
--
insert into tbl(clmn) values (0.9559);
insert into tbl(clmn) values (143.4753);
--
select clmn --
, convert(numeric(22,17),clmn) as clmn_expanded -- returns type numeric(22,17) to make true stored value fully visible
, round(clmn, 2) as round_to_2dec --
, round(clmn, 2)*100 as round_to_2dec_mult_100 --
, cast (round(clmn, 2)*100 as integer) as round_to_2dec_mult_100_as_INT
--
from tbl;
Read more...
Product
Keywords
round, cast, convert, wrong result, accuracy, different result. , KBA , BC-SYB-IQ , Sybase IQ , How To
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.