动态sql语句在游标中的应用
declare @wstr varchar(500)set @wstr=' and conname=''CLASS GROUP'''exec sp_executesql N'select distinct conname from lzq_v_record where isnull(conname,'')<>'' @wstr',N'@wstr varchar(500)',@wstr
declare c_t_sfc cursor forexec sp_executesql N'select distinct conname from lzq_v_record where isnull(conname,'')<>'' +@wstr',N'@twstr varchar(500)',@twstr
exec(’ declare curOne cursor global for’ + @aSql) open curOne