我现在有一个张表,主键不是自动增长的,我希望再加个主键上去,设置为自动增长的,好象mysql提示说只有主键才能自动增长,而且以有一个主键了,请问如何解决这个问题啊,给点意见啊,谢谢了

解决方案 »

  1.   

    Yeah,there is only one column defined with the auto_increment attribute and it must be primary key.
    You can calculate the exact value in the before insert trigger or store procedure.
      

  2.   

    在Sql Manager中
    双击表,显示所有列名,
    双击要自增长的列名,勾选:Autoincrement
      

  3.   

    thank you,it 's ok,add index for column ,after set column auto_increment 
    先给这个字段加个索引index,然后再设置为自动增长便可以