Nik
Nik

Reputation: 21

Load data Infile Issue in MySQL(Incorrect String Value Error)

I am trying to insert data(24,000+ rows)from a text file to a MySQL table. I am using following Load Data Infile query which reads data from empdump.txt & inserts it in a table called o_master_employees in MYSQL.

Query Is:

LOAD DATA INFILE 'empdump.txt' 
INTO TABLE o_master_employees 
FIELDS TERMINATED BY '\t' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n';

But here I'm facing with a error which is:

Incorrect string value: '\x92s MS ...' for column 'PID_DESCR' at row 101

I've checked with the data in PID_DESCR column & data is FedEX's MS Prod Support

Can u please help me to identify what this error is about & what can be the solution???

Thanks in advance ! :)

Upvotes: 2

Views: 3077

Answers (1)

peschü
peschü

Reputation: 1349

If your data is in UTF-8 you might have success with

LOAD DATA INFILE 'empdump.txt' 
CHARACTER SET utf8
INTO TABLE o_master_employees 
FIELDS TERMINATED BY '\t' 
OPTIONALLY ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n';

(I added the CHARACTER SET line.)

Upvotes: 1

Related Questions