日期:2014-05-18  浏览次数:20471 次

在 exec 里的 table 变量怎么操作?
exec   ( '
Declare   @Co   int
declare   @name   table(id   uniqueIdentifier)
Insert   into   @name   select   id   from   sysobjects
Select   @Co=Count(1)   From   sysobjects
exec   ( ' 'select   top   ' '+@Co+ ' '   *   From   ' '+@name+ ' '   ' ')
')

这句怎么改?

------解决方案--------------------
exec ( '
Declare @Co int
declare @name table(id Int)
Insert into @name select id from sysobjects
Select @Co=Count(1) From sysobjects
set rowcount @Co
select * from @name
set rowcount 0 ')