I’m trying to import a CSV files into my MySQL table using the following query:
LOAD DATA INFILE 'C:\\machines.csv'
INTO TABLE `machines`
CHARACTER SET latin1
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 0 LINES;
However it give the following error
1406- Data too long for column ‘technicalInfo’ at row 10334
It seems that the issue is that the row contains a ⌀ character in the technicalInfo column.
Is it possible to remove/replace this character within the query?
(N.B. Obviously another solution would be to remove it from the csv file itself. The problem is that I am likely to be importing different versions of this file multiple times every day, so I’d rather build it in to the query.)
The problem is that the ‘⌀’ character is not available in the
latin1character set and that is why you’re getting the error. Can you change the character set toutf8and see if you still experience the problem?[1] MYSQL Error 1406 details: http://bugs.mysql.com/bug.php?id=18908