select [id]=identity(int,1,1),b,c into # from 表select * from #

解决方案 »

  1.   

    --临时表是一个解决方法
    --楼主如果B,C能确定唯一一条记录也可以这样写
    select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a
      

  2.   

    楼上的方法可以,另一解决方法是增加一个自增列:
    alter table 表名 add ID bigint identity(1,1)
      

  3.   

    select identity(int,1,1) as id,lower(b) as b,lower(c) as c from tablename
      

  4.   

    更正一下
    select identity(int,1,1) as id,lower(b) as b,lower(c) as c into #t from tablename
    select * from #t
      

  5.   

    回复人: zlp321002(想在北京找份工作!) ( ) 信誉:104  2005-09-05 18:41:00  得分: 0  
     
     
       --临时表是一个解决方法
    --楼主如果B,C能确定唯一一条记录也可以这样写
    select 序号=(select sum(1) from 表 where b+c<a.b+a.c),* from 表 a
      
     
    --这个恐怕不行,搂主的排序不是这样的