List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:April 9 2001 8:50pm
Subject:Re: auto id repair
View as plain text  
On Mon, Apr 09, 2001 at 04:36:20PM -0400, Hao Zhuang wrote:
> I have several tables with id fields using auto_increment as the attribute.
> Sometimes I need to delete the old records, those number can not be reused
> any more.  Is there any way I can rearrange those id numbers make them
> continuous?

Why bother?  MySQL doesn't care whether or not they're continuous.

If you really want to do this, drop the column and add it again
with ALTER TABLE.  MySQL will assign new sequence numbers.

> Example:
> id1: 1,2,3,4,5,6
> after I deleted some records, I will have: 2,3,6
> How can I rearrange the id, so that they are in order of :1,2,3
> Did anybody do that kind of thing before?
> Thanks,
> Hao
auto id repairHao Zhuang9 Apr
  • Re: auto id repairPaul DuBois9 Apr
  • Re: auto id repairEgil Helland9 Apr
  • Re: auto id repairEgil Helland9 Apr
  • Re: auto id repairEgil Helland9 Apr
  • RE: auto id repairAndre Moll10 Apr
Re: auto id repairHao Zhuang10 Apr