List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 29 1999 6:11am
Subject:Re: ERROR 1062
View as plain text  
At 5:03 PM -0700 10/28/99, John Embow wrote:
>>At 4:01 PM -0700 10/28/99, John Embow wrote:
>>>Hello,
>>>
>>>I'm trying to drop all the rows in my database and reloading  the 
>>>data with a  LOAD DATA LOCAL INFILE  command. Problem is the 
>>>primary key field is auto-incrementing,  so i modify the column to 
>>>remove this, import the data, and then remodify the column to add 
>>>auto-incrementing again.  I get all the way to the part where i 
>>>try to remodify the column, and i keep getting the error:
>>>
>>>alter table blah
>>>modify id smallint(5) unsigned not null primary key auto_increment;
>>>
>>>ERROR 1062: Duplicate entry '587' for key 1
>>>
>>>I've also tried dropping the key and readding it, but i still get 
>>>the same error.
>>
>>
>>Hm.  587 is a strange number, but try dropping it and adding
>>it as a mediumint or int and see what happens.
>>
>What version of MySQL, by the way?
>
>it's version 3.22.25.  Tried dropping and readding, but each time i 
>modify to make the switch to primary key/auto increment i get the 
>same error message. Any ideas?


As I read your original question again, it's not clear to me what
you're doing.  Are you saying that you're loading the column with
values, then adding the auto_increment attribute to it and making it
a primary key?  Because if you are, and your values aren't unique,
then you'll certain get an error of the type you're reporting.

-- 
Paul DuBois, paul@stripped
Thread
ERROR 1062John Embow29 Oct
  • Re: ERROR 1062Paul DuBois29 Oct
    • Re: ERROR 1062John Embow29 Oct
      • Re: ERROR 1062Paul DuBois29 Oct
Re: ERROR 1062John Embow29 Oct
Re: ERROR 1062John Embow29 Oct