wordpress - Resolving a duplicate primary key on mysql import -


i'm looking append comments table 1 wordpress site another. users different. when import comments site b a, run duplicate key issue; comment_id taken.

so how can resolve , append table simple .sql file? have take user information, generate new user, check comments made on site b, pull content , postid, go site , recreate comment newly created user!?

what headache! thanks.

if problem duplicate key issue, go end of sql file after engine=myisam , make engine=myisam autoincrement=a nubmer above last id in new database

or

query database last id add 1 , use on new insert query.

example 1:

create table if not exists `movies` (   `id` int(255) not null auto_increment,   `title` varchar(255) not null,   `year` int(4) not null,   `size` varchar(255) not null,   `added` date not null,   primary key (`id`),   unique key `title` (`title`,`year`) ) engine=innodb  default charset=latin1 auto_increment=4 ; 

the inserts dump:

insert `movies` (`title`, `year`, `size`, `added`) values ('[rec] 2', 0, '716688', '2011-09-23'), ('5 days of war', 0, '1435406', '2012-01-09'), ('[rec]', 0, '1353420800', '2011-11-06'); 

see how didnt include primary key (id) in includes, still check against unique key , see if title exists. little demo helps out. if table exists on new database skip inserts , dont include primary key , auto set on new insert next available value.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -