select identity(int,1,1) as NID,* into #temp from 表名
drop table 表名
select * into 表名 from #temp
drop table #temp

解决方案 »

  1.   


    select idd=identity(int,1,1),* into #t from 表名 where 条件
    --将你需要的数据存入一个临时表中,并给该表加了一个自动增长的ID,select * from #t where idd=N
    --通过这个ID来,选择你想要的.
      

  2.   

    用一個自動增量函數就行了。
    identity(int,1,1)不過這個要結合虛擬表一起用哦
    select identity(int,1,1) as [id],* into #temp from tablename where 条件