select identity(int,1,1) id,* into #tmp from 表
select * from #tmp
drop table #tmp

解决方案 »

  1.   

    Rotaxe(程序员):
         能不能不用臨時表?
      

  2.   

    alter table 表 add id identity(int,1,1)
    select * from 表
    alter table 表 drop column id
      

  3.   

    select (select sum(1) from tablename a where a.col1<=b.col1),* from tablename b
      

  4.   

    alter table 表 add id identity(int,1,1)
    select * from 表
    alter table 表 drop column id
      

  5.   

    wzh1215(四脚蛇)﹕
         大哥你的方法好像更激進了