如果pn这么有规律,可以Update TableName Set hh=1000+Right(pn,1)

解决方案 »

  1.   

    或者如果pn没有上述规律,但有大小规律的话。Update A Set hh=1000+(Select Count(1) from TableName Where pn<=A.pn) from TableName A
      

  2.   

    不好意思,没有写好,被误解了.
    后面的pn是没有任何规律的.所以无法跟据PN来修改.to ziping(子平) 
    用个临时表来处理一下吧
    要如何处理呢?
      

  3.   

    select identity(int,1001,1) [ID],* into # from table1
    update table1 set hh=A.ID from table1 join # A on A.hh=table1.hh and A.pn=table1.pn
    drop table #
      

  4.   

    谢谢大家的提示.
    我的问题解决了.
    使用了vivianfdlpw的方法.