I have a Table in MySQL and I am adding data to it from a csv file
My code is:
LOAD DATA LOCAL INFILE 'C:/myaddress/file.csv' INTO TABLE db.mytable FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (`Currency`,`field2`,`field3`)
This loads fine except for the first row I add.
I'm adding a
USD but when I do a query it imports it as
ï»¿USD. This only happens for the first row. Anybody knows why this happens?
Solution: This is an encoding issue, so to solve it, here are two options
1.- Encode the file differently
2.- Add a dummy line and use
IGNORE 1 LINES