select * from a where bm='01'得到
mc      xh
001
0510
0688
23
234
234
234
24
2
我想修改xh使xh为顺序号,得到
mc      xh
001     1
0510    2
0688    3
23      4
234     5
234     6
234     7
24      8
2       9

解决方案 »

  1.   


    declare @n int
    set @n=1update ta
    set xh=@n,@n=@n+1
      

  2.   


    declare @n int
    set @n=1update ta
    set xh=@n,@n=@n+1 where bm='01' 
      

  3.   

    declare @n int
    set @n=0
    update ta
    set xh=@n,
    @n=@n+1 
    where bm='01' 
      

  4.   

    declare @n int
    set @n=1            --初值1update ta
       set xh=@n,@n=@n+1  --先更新再累加
       where bm='01' declare @n int
    set @n=0           --初值1
    update ta
       set @n=@n+1 xh=@n --先累加再更机关报
       where bm='01'