CREATE procedure pd_name @M int,@N int as declare @Count int set @Count=@M+@N exec ('select top '+@N+' * from (select top '+@Count+' * from tablename order by ID) a order by a.ID desc') GO
select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表 select * from #temp where ID_Num between 10 and 20
as
declare @Count int
set @Count=@M+@N
exec ('select top '+@N+' * from (select top '+@Count+' * from tablename order by ID) a order by a.ID desc')
GO
select * from #temp where ID_Num between 10 and 20