本帖最后由 amandag 于 2010-07-28 13:57:02 编辑

解决方案 »

  1.   

    你这个应该是第100条到第200条的数据,而且第100条的id不一定是100,要提取这范围之间的数据挺容易的
    可以用top,max,row_number()方案(sql server2000不支持)
    top:
    select top 100 * from 表 where id not in (select top 100 id from 表)
      

  2.   

    select top m * into 临时表(或表变量) from tablename order by columnname 
    set rowcount n
    select * from 表变量 order by columnname desc
      

  3.   

    select * from (                  
    select row_number() over (order by 排序字段) as rownum,其他字段
    from table)aa
    where rownum between 100 and 200
      

  4.   

    select top 100 * from A 
    where ID>
    (
    select max(ID) 
    from (select top 100 ID from A )T
    )
      

  5.   

    select top 100 * from 表 where id not in (select top 100 id from 表)
      

  6.   

    136. 写出一条Sql语句: 取出表A中第31到第40记录(SQLServer, 以自动增长的ID作为主键,  注意:ID可能不是连续的。) 
        1:  select top 10 * from A where id not in (select top 30 id from A) 
     解2:  select top 10 * from A where id > (select max(id) from (select top 30 id from A )as A) 
      

  7.   

    用LINQ,一行就行了。比方说:
    context.Products.Skip(100).Take(100);here:
    context inherit from System.Data.Linq.DataContext
    Products stands for Table Product
      

  8.   

    select top 100 * from 表 where id not in (select top 100 id from 表 order by col) order by col
      

  9.   

    select top 100 * from 表 where id not in (select top 100 id from 表)
    这个不就行了么
      

  10.   

     sql 00也是可以的,楼主网上找找肯定有,sql 05中是row_number()
      

  11.   

    分页,sql2005以前是通过存储过程来实现的
    2005 row_number()如下:
    select a.* from(select row_number() over(order by user_id desc) rowNumber,user_id from pub_block)temp join pub_block a on a.user_id = temp.user_id and temp.rowNumber between 10 and 20 order by user_id desc