List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 7 2002 2:59am
Subject:Re: Easy Auto-Increment
View as plain text  
At 22:59 -0400 7/6/02, Brad W. Galiette wrote:
>Is there any easy way to create a column in a MySQL table which
>automatically
>increments with each successive INSERT request?  (I understand that
>AUTO_INCREMENT inserts a value that is one greater than the greatest that
>already exists in the table; however, this creates a problem --- from the
>position of creating a web interface --- of what occurs when the record
>holding the greatest value for the AUTO_INCREMENT column is dropped.  Thus
>it would be possible to confuse two records which, in the end, would have
>had the same identifying value.  Is there any work around to this issue to
>continue incrementing even if the record holding the greatest AUTO_INCREMENT
>value is deleted?

The behavior you describe (reuse of values) occurs for ISAM tables.
If you use a MyISAM table instead, values will increase monotonically,
even if DELETEs occur.

>Thank you in advance for your support!
>
>Regards,
>Brad Galiette

Thread
Easy Auto-IncrementBrad W. Galiette7 Jul
  • Re: Easy Auto-IncrementPaul DuBois7 Jul