当前位置: 代码迷 >> Sql Server >> 关于嵌套变量的求教!解决方法
  详细解决方案

关于嵌套变量的求教!解决方法

热度:82   发布时间:2016-04-27 12:44:35.0
关于嵌套变量的求教!
declare @kc money,@sql varchar(8000)
set @kc=50
......
set @sql='select b.clsname,a.* from ([email protected]+') as a,clsitem b where countn<=变量KC and a.clscode=b.clscode'


代码该如何写啊?是countn<[email protected]+'''还是什么呢?


------解决方案--------------------
SQL code
countn<=''''+ltrim(@kc)+''''
------解决方案--------------------
SQL code
set @sql='select b.clsname,a.* from ([email protected]+') as a,clsitem b where countn<= [email protected]+''' and a.clscode=b.clscode'
  相关解决方案