22,209
社区成员
发帖
与我相关
我的任务
分享
declare @jsgs varchar(60)
with cte(GPrice,Fomula) as (select 500,'Round(GPrice*41/31,2)' union select 770,'Round(GPrice*61/31,2)')
select @jsgs=replace(Fomula , 'GPrice' , cast(isnull(GPrice,0.0) as varchar)) from cte
exec('select '+@jsgs+' as exe')
这个计算正常,语法也简单,要实现多条的话,用游标就可以