List:General Discussion« Previous MessageNext Message »
From:Michael Stassen Date:August 30 2004 3:17pm
Subject:Re: Duplicate Keys when auto-increment??
View as plain text  
Probably your id is a TINYINT, which has a range of -128 to 127.  Change it 
to something bigger.  And make it UNSIGNED so as not to waste half the 
range.  See the manual for details 
<http://dev.mysql.com/doc/mysql/en/Numeric_type_overview.html>.

So, you need something like

   ALTER TABLE Hello CHANGE id id INT UNSIGNED AUTO_INCREMENT;

<http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html>

Michael

Rui Monteiro wrote:

> Hello there,
> 
>  
> 
> Does anyone ever had this problem:
> 
>  
> 
> Table Hello ***********
> 
>  
> 
> id - (PK) auto-increment
> 
> name - text
> 
> .
> 
> **************************
> 
>  
> 
> After some insert's, the table starts to getting erros due to "Duplicate
> entry" for the ID.
> 
> But the ID is been auto-incremented!
> 
>  
> 
> I do something like this:
> 
>  
> 
> Insert into hello values ('','wedmwe')
> 
>  
> 
> Or 
> 
>  
> 
> Insert into hello (name) values ('werio')
> 
>  
> 
>  
> 
> Why is the error happening now? It started at the 127th entry.
> 
>  
> 
> Thanks for the help.
> 
>  
> 
>  
> 
> 
Thread
Duplicate Keys when auto-increment??Rui Monteiro30 Aug
  • Re: Duplicate Keys when auto-increment??Dan Nelson30 Aug
    • RE: Duplicate Keys when auto-increment??Rui Monteiro30 Aug
  • Re: Duplicate Keys when auto-increment??Michael Stassen30 Aug
AW: Duplicate Keys when auto-increment??KSTrainee30 Aug
RE: Duplicate Keys when auto-increment??John McCaskey30 Aug