LOAD DATA LOCAL INFILE custom value

Posted by NR03 on Stack Overflow See other posts from Stack Overflow or by NR03
Published on 2012-10-18T22:57:20Z Indexed on 2012/10/18 23:00 UTC
Read the original article Hit count: 108

Filed under:
|

How to add a custom value using LOAD DATA LOCAL INFILE? The column time_added is the 7th column and the file has only 2 values for the first and the second column. For the 7th column, time_added I want to use the unix timestamp when loading from file.

This code isn't working:

$result = mysql_query("LOAD DATA LOCAL INFILE '{$myFile}' INTO TABLE {$table} FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n' SET `time_added`=unix_timestamp()");

© Stack Overflow or respective owner

Related posts about mysql

Related posts about query