List:General Discussion« Previous MessageNext Message »
From:Gary Smith Date:January 3 2010 12:54am
Subject:Re: Importing table contents
View as plain text  
Patrice Olivier-Wilson wrote:
> Gave it a try got this:
> MySQL said:
>
> #1062 - Duplicate entry '1' for key 1
Yeah, that's what I was saying about in my previous mail. It looks like 
you've got a primary key on one of your columns, and you're attempting 
to insert data into it with a duplicate primary key (ie what the error 
message says). The easiest way to get around this one would be to write 
a query that pulls all of the columns apart from the primary key, and 
then replace that field with '' or somesuch.

For instance, let's say you've got a schema of the following:

table1(primarykey,column2,column3,column4,column5)

primarykey is obviously a primary key. You'd do something along the 
lines of select '',column2,column3,column4,column5 from table1;

Then export that resultset to an SQL file.

Anyone else aware of an easier way to do this? I've got into some bad 
habits over the years, but I'm not aware of another way to do what 
Patrice is trying to do.

Cheers,

Gary
Thread
Importing table contentsPatrice Olivier-Wilson2 Jan
  • Re: Importing table contentsGary Smith2 Jan
    • Re: Importing table contentsPatrice Olivier-Wilson2 Jan
      • Re: Importing table contentsGary Smith2 Jan
        • Re: Importing table contentsPatrice Olivier-Wilson2 Jan
          • Re: Importing table contentsGary Smith3 Jan
            • Re: Importing table contentsPatrice Olivier-Wilson3 Jan