create table test_int
(
num bigint
)
insert into test_int (num)
values (4096);
My task is to calculate 4096/1024/1024 and get decimal answer. Ok, int doesn't store values after dot, so:
select CAST (num as decimal)/1024/1024 AS decimal, ROUND ((CAST (num as decimal)/1024/1024),4,1) AS numeric from test_int
First one is pure resault, second one is after rounding:
decimal numeric 0.00390625000 0.00390000000
The task is to remove empty zeroes after values.
select convert(decimal(25,5), 4096/1024/1024 ,0)
returns 0.00000.
So how can I get 0.0039 instead of 0.00390000000? Thanks in advance for any kind of help.
Aucun commentaire:
Enregistrer un commentaire