create table #table{
  id int identify (1,1)
  name varchar(10)
}
insert into #table select * from table
使用虚表,建立一个名id identify 1 ,1 的字段
select * From #table where id>=i and id<j;

解决方案 »

  1.   

    前面有解决的方案
     i=20 ,j=30
    select top 30 * from table1
    where id not in (select top 19 * from table1)
      

  2.   

    OpenVMS(半知半解)的解决方法对我很有启发但速度会不会很慢?
      

  3.   

    看到过解决方案,好象可以这样写:
    i=20 ,j=30
    select top 10 * from (select top 30 * from tablename) ta order by id desc
      

  4.   

    感谢 hycao(海草) 对问题的解决!
      

  5.   

    请问  badtank(新建文件夹(目标一个红星 前进)) 你的create语句中
    int identify(1,1)是什么意思啊?不好意思我还是个菜鸟。
      

  6.   

    select identity(1,1) as myid,* into #temp from tablename
    select * from #temp where myid>=@i and myid<=@j
      

  7.   


    select identity(int,1,1) as myid,* into #temp from tablename
    select * from #temp where myid>=@i and myid<=@j
      

  8.   

    有没有人测试过select identity(int,1,1) as myid,* into #temp from tablename
    select * from #temp where myid>=@i and myid<=@ji=20 ,j=30
    select top 10 * from (select top 30 * from tablename) ta order by id desc哪个速度快?
      

  9.   

    ID是连续的,那速度就是最快的:
      i : start
      j : end
      select top j-i * from table id>i