List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 15 2001 1:49pm
Subject:Re: auto_increment "update"
View as plain text  
At 10:39 AM +0200 6/15/01, Sven Huster wrote:
>On Thu, Jun 14, 2001 at 07:30:01PM -0500, Paul DuBois wrote:
>>  *This message was transferred with a trial version of CommuniGate(tm) Pro*
>>  At 1:36 AM +0200 6/15/01, Sven Huster wrote:
>>  >Hi there
>>  >
>>  >can i somehow easily recreate the auto_increment col if is was not
>>  >correctly set?
>>  >i just recognized that most rows contain "1" cause the primary key was
>>  >set
>>  >on the auto_increment col + another one.
>>  >so mysql only creates a entry > 1 if the other field was equal to
>>  >another row.
>>
>>  Well, that's what's supposed to happen if you have a primary key
>>  or unique key on multiple columns where the last column is an
>>  AUTO_INCREMENT value.  If you want your AUTO_INCREMENT column
>>  to have unique values for each row, then you could drop that
>>  index and set up a PRIMARY KEY on just the AUTO_INCREMENT column.
>>
>>  Actually, I'm not sure I understand what you want to do, so I'm
>>  just guessing.  If that doesn't answer your question, please
>>  clarify.
>
>Hi
>
>i want to fix the auto_increment col to have unique entries, but if i drop
>the index
>there are double entries in for the col, so i dont think it works just by
>dropping the
>key.
>there is data in the table that i dont want to loose.

Drop the AUTO_INCREMENT column, than add it back as an AUTO_INCREMENT
PRIMARY KEY.  MySQL will number the columns values uniquely for you.

>
>regards
>sven


-- 
Paul DuBois, paul@stripped
Thread
auto_increment "update"Sven Huster15 Jun
  • Re: auto_increment "update"Paul DuBois15 Jun
Re: auto_increment "update"Sven Huster15 Jun
  • Re: auto_increment "update"Paul DuBois15 Jun