select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表
select * from #temp where ID_Num between 10 and 20

解决方案 »

  1.   


    可以啊,只要唯一字段,也可以啊,或者自己插到一张新表里,自己做identity这样的效果很好吗? ^-^
      

  2.   

    因为不是针对某一个特定的表,所以有可能没有唯一字段。
    目的是在程序中备份(不想用bcp),考虑到某些历史表相当大,所以要分批查询。
      

  3.   

    select IDENTITY(int, 1,1) 
    AS ID_Num,* 
    into #temp 
    from 表
    select * 
    from #temp 
    where ID_Num >100 and ID_Num<1000