martin-damien
1/11/2017 - 7:07 AM

Import CSV file in MySQL

Import CSV file in MySQL

SET SESSION sql_mode = ''; /* disable strict typing, to avoid errors like ERROR 1366 (HY000): Incorrect integer value: '' for column 'ESAANN' at row 1 */
LOAD DATA INFILE "/path/to/sirc.csv"
    INTO TABLE entreprises
    CHARACTER SET latin1
    COLUMNS TERMINATED BY ';'
    OPTIONALLY ENCLOSED BY '"'
    ESCAPED BY '"'
    IGNORE 1 LINES;