select identity(int,1,1) as id,* into #t from table
select * from #t where id between M and Ndrop table #t

解决方案 »

  1.   

    select top M-N * 
    from
    (select top M *
    from 表
    order by 字段1 desc,...字段n desc 
    )A
      

  2.   

    teaism() ( ) 信誉:100 的回答很不错,对数据量大也合适。
      

  3.   

    select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
    select * from #temp where ID_Num between 10 and 20或:declare @SQLStr varchar(8000)
    set @SQLStr='SELECT Top '+cast(@每页大小 as varchar)+' * FROM 表 WHERE 主键列 NOT IN (SELECT TOP '+cast(@每页大小*@第几页 as varchar)+' 主键列 from 表 )'
    exec(@SQLStr)