34,593
社区成员
发帖
与我相关
我的任务
分享
Create table #temp
(
a numeric(20,10),
q numeric(10,4), --看这里 沟沟正解、沟沟正解、沟沟正解
w numeric(5,4),
e numeric(5,4),
)
insert into #temp
select 1.6728333333,12,0,0
select a*(q-w) from #temp
select a*(q-w-e) from #temp
/*
---------------------------------------
20.0739999996000000
(1 行受影响)
---------------------------------------
20.0739999996000000
(1 行受影响)
--可用下述方式,测试玩
declare @n1 numeric(28,10), @n2 numeric(28,4), @n sql_variant
select @n1=1.23456789 , @n2=0.0001
select @n=@n1*@n2
select [value]=@n,
[type]=sql_variant_property(@n,'basetype') ,
[precision]=sql_variant_property(@n,'precision') ,
[scale]=sql_variant_property(@n,'scale')
/*
value type precision scale
---------------------------------------------------
0.000123 numeric 38 6
*/