MySQL Forums
Forum List  »  PHP

Re: Re-Ordering ID
Posted by: Jonathan Stephens
Date: June 08, 2005 12:43AM

Just drop the auto_increment column and then add a new one using ALTER TABLE:

ALTER TABLE mytable DROP myid;
ALTER TABLE mytable ADD myid INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (myid), AUTO_INCREMENT=1;

http://dev.mysql.com/doc/mysql/en/alter-table.html

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
June 05, 2005 03:18PM
Re: Re-Ordering ID
June 08, 2005 12:43AM
June 09, 2005 02:53PM
June 09, 2005 11:14PM
June 14, 2005 04:18AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.