参考:
http://blog.csdn.net/xluzhong/articles/277598.aspx

解决方案 »

  1.   

    游标是可以的.
    但是会写的太死.
    我不知道是否有更好的办法.
    期待ing.
      

  2.   

    你的表里面如果没有ID这样的字段??就用临时表吧select IDD=identity(int,1,1),* into #t  from table
    select * from #T Where IDD Between 1 And 10
    select * from #T Where IDD Between 2 And 5
    select * from #T Where IDD Between 5 And (Select Max(IDD) from #T)
    Drop table #T
      

  3.   

    回复人: xluzhong(打麻将一缺三,咋办?) ( ) 信誉:100 
    的方法比较喜欢。
    ————————————————————————————————————————
    2.如果table1中col1的值唯一,也可以如下select top 2000 * from table1 where col1 not in (select top 1000 col1 from table1)
      

  4.   

    开头到N条记录
    Select Top N From 表
    -------------------------------
    N到M条记录(要有主索引ID)
    Select Top M-N * From 表 Where ID in (Select Top M ID From 表) Order by ID  Desc
    ----------------------------------
    N到结尾记录
    Select Top N * From 表 Order by ID Desc
      

  5.   

    要有用于排序的字段(如ID)
    SELECT * FROM TABLE A WHERE (SELECT COUNT(*) FROM TABLE WHERE ID<=A.ID) BETWEEN 10 AND 20