I have a game sql so i can import games. I have more than 3000 inserts in the sql. I have splitted the file and started to import then. however i sometimes get the error that there is a duplicate key. the i have to remove the key from the sql file and import it again. then it stops at another duplicate key.. etc what can i add to the sql file to skip the duplicated keys ?? all insert keys are like that. INSERT INTO `games` (`gId` ,`gInCategory` ,`gSwfFile` ,`gName` ,`gOrder` ,`gVisible` ,`gThumb` ,`gWidth` ,`gHeight` ,`gDescription` ,`gplays` ,`description2` ,`sponsor_name` ,`sponsor_link`) VALUES (2376,106,'f-147.swf','Track and Field',0,1,'f-147.png',508,440,'Old school classic nintendo game play different olympic sports hurdles fencing and more.',0,'','',''); Code (markup): any help would be appriciated thanks
Maybe there are some records in the table from an earlier attempt that are throwing things off? You can remove the constraints (unique constraint) from the gId column. Once the import is completed you will want to renumber all your rows, or determine which rows are duplicates and give them a new id number. Then you should be able to readd the constraints.
Any other way, where I can edit the sql file to add to the insert line to skip values if it is duplicated
INSERT IGNORE .... By putting the IGNORE after the insert statement it will simply ignore duplicate key conflicts.