exec('select '+@FdName+'=identity(int,0,1),'+@FdShow+'
into #tb from('+@QueryStr+') a '+@FdOrder+'
select '+@FdShow+' from #tb where '+@FdName+' between '
+@Id1+' and '+@Id2
)--改为:exec('select '+@FdName+'=identity(int,0,1),'+@FdShow+'
into #tb from(select top 100 percent * from'+@QueryStr+@FdOrder+')a
select '+@FdShow+' from #tb where '+@FdName+' between '
+@Id1+' and '+@Id2
)