set @SQL =N'select name,count(id) as count from '+@TableName+' group by name having count(id)>1 '
DECLARE cur_repeat CURSOR FOR
Exec( @SQL )
=====>
set @SQL =N'select name,count(id) as count from '+@TableName+' group by name having count(id)>1 '
Exec('DECLARE cur_repeat CURSOR FOR '+ @SQL )
DECLARE cur_repeat CURSOR FOR
Exec( @SQL )
=====>
set @SQL =N'select name,count(id) as count from '+@TableName+' group by name having count(id)>1 '
Exec('DECLARE cur_repeat CURSOR FOR '+ @SQL )
Exec( @SQL )
------------->
没有得到返回值啊!N'select @name=name,@count=count(id) as count from '+@TableName+' group by name having count(id)>1 '
exec sp_executesql @sql,N'@count int output,@name varchar(10) output',@count output,@name output