不会吧,设计表,然后把aaid的标识改为是,即改为自动增长,这不就行了吗

解决方案 »

  1.   

    如果你能用某一个或几个字段来确定一条记录,则可通过循环来很快的解决!
    select @lcSerio=1
    declare abc Cursor for select  能确定一条记录的字段列表
    from tablename
    open abc fetch next from abc into 与"能确定一条记录的字段列表"对应的变量
    while (@@fetch_status=0)
    begin
    update tablename set 主键列=@lnSerio where“确定一条记录的字段列表”与“定义的对应变量列表”组成的条件表达式
    select @lnSerio=@lnSerio+1

    fetch next from abc into 与"能确定一条记录的字段列表"对应的变量
    end

    close abc deallocate abc
      

  2.   

    select identity(int, 1,1) as aaid, * into office_a from gmcccard..office
      

  3.   

    alter table tablename
    add aaid  int identity(1,1) primary key
    加一个identity列