日期:2014-05-18 浏览次数:20455 次
create proc sp_test @kind varchar(20) as begin declare @sql varchar(8000) select @sql=isnull(@sql,'')+[sql] from tb exec (@sql) end
------解决方案--------------------
create proc wming as begin declare @sql varchar(4000),@i int,@j int select identity(int,1,1) rn, [sql] into #t from tab where [sql] like '%kind=5%' select @i=1,@j=@@ROWCOUNT while(@i<=j) begin select @sql=[sql] from #t where rn=@i exec(@sql) select @i=@i+1 end end