MySQL Forums
Forum List  »  Connector/ODBC

Re: Please explain why i get a incorrect string value error
Posted by: Bogdan Degtyariov
Date: May 06, 2020 12:26AM

With so little information it is not clear why exactly the LOAD DATA INFILE has failed, but one thing is very clear: the CSV file has bytes above 127:

\xEF\xBF\xBD --> convert to decimal --> xEF=239, xBF=191, xBD=189

MySQL is trying to interpret these bytes as multibyte characters and the conversion fails.

It is OK to have multibyte characters in the imported files, but specifying the character set would definitely help. So if your CSV file is UTF8 the LOAD DATA should looks like this:

load data infile 'C:\\ProgramData\\MySQL\\MySQL Server 8.0\\Uploads\\Pass0.csv'
into table autoscratch.pass0
CHARACTER SET utf8mb4
fields terminated by ','
enclosed by '"'
lines terminated by '\r\n'
ignore 1 rows;

More information on the syntax for LOAD DATA can be found here:
https://dev.mysql.com/doc/refman/8.0/en/load-data.html

Hope this helps.

Options: ReplyQuote


Subject
Written By
Posted
Re: Please explain why i get a incorrect string value error
May 06, 2020 12:26AM


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.