mysql add auto increment and a additional key
Posted
by Lee
on Stack Overflow
See other posts from Stack Overflow
or by Lee
Published on 2010-05-20T18:14:50Z
Indexed on
2010/05/20
19:00 UTC
Read the original article
Hit count: 214
Hey all
I am trying to alter a table with adding a new column setting it as auto increment and with a key.
The table already has one key and this one will be an addition. The error I get is the following.
error : Multiple primary key defined
My code is:
alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
I have also tries wrapping the key name ie
alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY (id) KEY FIRST;
But still no luck.
How can it be done ?
© Stack Overflow or respective owner