code_junkie

mysql duplicate entry error when there is no duplicate entry (bulk load via php)

Nov 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. > repair table mytablename;
  2.  
  3. > truncate table temptable;
  4. > truncate table importtable;
  5.  
  6. > #bulk insert new data
  7. > insert into importtable(col1,col2,col3)
  8. > values(1,2,3),(4,5,6),(7,8,9);
  9.  
  10. > #now archive the live data
  11. > insert into temptable(col1,col2,col3)
  12. > select col1,col2,col3 from livetable;
  13.  
  14. > #finally copy the new data to live
  15. > truncate table livetable;
  16. > insert into livetable(col1,col2,col3)
  17. > select col1,col2,col3 from importtable;
Add Comment
Please, Sign In to add comment