drop table #tmp
create table #tmp
(
c1 real
)
insert into #tmp
select 56.08
select cast(c1 as decimal(38,8) ) from #tmp
存入56.08
撈出來卻是56.08000183
56.8的科學記號為5.6080000E+01 但這樣為什麼會變成56.08000183
為什麼會這樣呢?
它是怎麼用01的方式存在DB裡呢?
#decimal point to two's complement
畢竟是近似值~如果可以縮小數點~你調整到小數第2位就好了@@
declare @tmp table
(
c1 real
)
insert into @tmp
select 56.08
select cast(c1 as decimal(38,2) )
,cast(c1 as decimal(38,8) )
,cast(c1 as decimal(38,25) )
from @tmp