select IDENTITY(int, 1,1) AS ID_Num,* into #temp from 表select * from #temp go
drop table #temp

解决方案 »

  1.   

    select identity(int, 1,1) as F1,* into #temp from 记录集
    select * from #temp 
    drop table #temp
      

  2.   

    Select no=(select count(*)+1 from bisfcdepa b where b.department_code<a.department_code),a.department_code from bisfcdepa a
    Order by a.department_code我的表名叫:bisfcdepa 
    其中含有字段department_code 并且department_code为关键字段
      

  3.   

    select (select sum(1) from yourtable where col<=tem.col) as NO,* from yourtable as tem
      

  4.   

    谢谢上楼的,你这种方法一定得有个前提,COL应该是主键,不然会有问题