Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
langsql
titleLOAD DATA
LOAD DATA LOCAL INFILE '/home/xxx/data.csv'
    INTO TABLE mydb.mytable -- make sure the table name is correct!
    FIELDS TERMINATED BY ';'
        OPTIONALLY ENCLOSED BY '"'
        ESCAPED BY '\\'
    LINES TERMINATED BY '\n'
    (@id, field_a, field_b, @flag, @filetime)
    SET
        id = @id+10000,
        filetime = FROM_UNIXTIME(@filetime),
        flag=IFNULL(@flag,0);   

Refer to mysql.com and syntax for more details.

Panel
titleTest environment

Ubuntu 10.10
Mysql server 5.1