List:General Discussion« Previous MessageNext Message »
From:Patrice Olivier-Wilson Date:January 3 2010 12:58am
Subject:Re: Importing table contents
View as plain text  
Gary Smith wrote:
> 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
>
If I export both db tables into csv, combine and then import back, that 
should do it, methinks...

just create a new table called tips2, merge the 2 into one...

-- 
Patrice Olivier-Wilson
888-385-7217
http://biz-comm.com

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