SELECT IDENTITY(int, 1,1) AS XUHAO,DDD as AAA,EEE as BBB,FFF as CCC
INTO TEST1
FROM TEST

解决方案 »

  1.   

    select identity(int,1,1) as xuhao,ddd,eee,fff into #temp from test order by fff
    insert into test1
      select * from #temp
      

  2.   

    select Identity(int,1,1) as xuhao,ddd,eee,fff into #temptable 
    from test  使用臨時表然後在用inser into test1 (aaa,bbb,ccc) select xuhao,ddd,eee,fff from #temp
      

  3.   

    insert test1 
     select (select count(*) from test where fff <= A.fff), 
            ddd, eee, fff from test as A
      

  4.   

    insert test1(xuhao,aaa,bbb,ccc)
    select xuhao=1+isnull((select count(*) from test where fff<a.fff),0),ddd,eee,fff
    from test a
      

  5.   

    如果是用UPDATE 语句更新表中的序号,该怎么写呢?谢谢!