Select identity(int,1,1) as iid,* into #tmp from 表
select * from #tmp where iid between 10 and 15
drop table #tmp

解决方案 »

  1.   

    CREATE PROCEDURE GetProductsPaged
    @lastProductID int,
    @pageSize int
    AS
    SET ROWCOUNT @pageSize
    SELECT *
    FROM Products
    WHERE [standard search criteria]
    AND ProductID > @lastProductID
    ORDER BY [Criteria that leaves ProductID monotonically increasing]
    GO
      

  2.   

    查询表中第m-n条记录:
    1。将前n条记录放入一临时表中。
    2。删除该临时表中前n-1条记录。
    3。显示此表
      

  3.   

    查询N-M条记录。
    select IDENTITY(int,1,1) as iid,* into #temptable from yourtable
    select top M-N * from #temptable where iid>=NOR:select top M-N * from yourTable where id not in(select top N-1 id from table)
    ID为表具有唯一值的任何字段
      

  4.   

    查询N-M条记录。
    select IDENTITY(int,1,1) as iid,* into #temptable from yourtable
    select top M-N * from #temptable where iid>=NOR:select top M-N * from yourTable where id not in(select top N-1 id from table)
    ID为表具有唯一值的任何字段
      

  5.   

    Select identity(int,1,1) as iid,* into #tmp from 表
    select * from #tmp where iid between 10 and 15
    drop table #tmp