Declare @RuleExp as Varchar(max)
,@Val1 Decimal(18,2) = 12.00
,@Val2 Decimal(18,2) = 13.00
select @RuleExp = @Val1 + @Val2
我需要值的总和(即)25。但我得到的字符串值为12.00 + 13.00。 请帮我解决这个问题。
提前致谢!
答案 0 :(得分:0)
Declare @RuleExp Decimal(18,0)
,@Val1 Decimal(18,2) = 12.00
,@Val2 Decimal(18,2) = 13.00
select @RuleExp = @Val1 + @Val2
select cast(@RuleExp as varchar(max))
答案 1 :(得分:-1)
Declare @RuleExp as Varchar(max)
,@Val1 Decimal(18,2) = 12.00
,@Val2 Decimal(18,2) = 13.00
set @RuleExp = @Val1 + @Val2
select @RuleExp