MySQL Forums
Forum List  »  MySQL Workbench

Re: Loading a file into MYSQL table error code 1062 Duplicate entry for primary key
Posted by: Shawn Green
Date: February 17, 2018 01:35PM

You cannot have a single row of all NULL values as NULL values cannot exist in the column(s) that define your PRIMARY KEY. At the very least, you must have a value in that location if you have any rows on this table. (a key can be composed of multiple columns)

Is it possible that in your PK column(s) you have a string of 'NULL' (which is different than the pseudovalue NULL) and that is what is being duplicated by your import?

Also... check that the two columns where you want this two-column Excel export to land are the first two columns defined on the table. If they are not, you will need to use the SET syntax of the LOAD TABLE command to map your incoming fields (from your CSV file) to different column names.

Yours,
--
Shawn Green
MySQL Senior Principal Technical Support Engineer
Oracle USA, Inc. - Integrated Cloud Applications & Platform Services
Office: Blountville, TN

Become certified in MySQL! Visit https://www.mysql.com/certification/ for details.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Loading a file into MYSQL table error code 1062 Duplicate entry for primary key
94
February 17, 2018 01:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.