Modifying a field to be auto_increment
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:I need to modify my primary key to be an auto_increment field.
Answer:For some reason
Table name: T1, primary key field name: F1
alter table T1 change F1 F1 integer not null auto_increment;
will work, but
alter table T1 change F1 F1 integer not null auto_increment primary key;
does not work. However, after statement #1 the field F1 will still be the primary key. This was observed in mysql 4.0