如果是整数除以整数,那么结果就是整数,小数部分都会被截断
select 100/101
select 100*1.0/101
Select cast(100*1.0/101 as decimal(18, 1))
Select cast(100*1.0/101 as decimal(18, 2))
Result:
0
0.990099
1.0
0.99
select 100*1.0/101
Select cast(100*1.0/101 as decimal(18, 1))
Select cast(100*1.0/101 as decimal(18, 2))
Result:
0
0.990099
1.0
0.99