关于嵌套变量的求教!
declare @kc money,@sql varchar(8000)
set @kc=50
......
set @sql='select b.clsname,a.* from ('+@sql+') as a,clsitem b where countn<=变量KC and a.clscode=b.clscode'
代码该如何写啊?是countn<='''+@kc+'''还是什么呢?
------解决方案--------------------SQL code
countn<=''''+ltrim(@kc)+''''
------解决方案--------------------
SQL code
set @sql='select b.clsname,a.* from ('+@sql+') as a,clsitem b where countn<= '''+@kc+''' and a.clscode=b.clscode'