Return to Snippet

Revision: 25398
at March 30, 2010 06:16 by simondiercks


Initial Code
alter table t1, change id id int (11) DEFAULT '0' NOT NULL, drop primary key;
ALTER TABLE table ADD id2 INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id2);
alter table t1, change id2 id2 int (10)  NULL, drop primary key;
alter table t1, change id id int (11)UNSIGNED  DEFAULT '0' NOT NULL AUTO_INCREMENT, add primary key(id);

Initial URL


Initial Description
How to add an auto-incremented column to an existing table without ex- and reimporting.

Initial Title
add auto-imcremented column to existing table without ex- and reimporting

Initial Tags
mysql, table

Initial Language
MySQL