> using mysql 4.0.24 I'm stuck with a problem importing a CSV-file
converting the date in the CSV from MM/DD/YYYY to a mysql table..
>
> I'm trying:
> LOAD DATA INFILE '/tmp/mydata.csv'
> INTO TABLE mytable
> FIELDS        TERMINATED BY ','        OPTIONALLY ENCLOSED BY '"'
> (recordType, serviceType,STR_TO_DATE(gmtDate,'%m/%d/%Y');
>
> The date in the CSV-file field #3 is in format MM/DD/YYYY and therefore
not importet correctly;
> Obvisouly I'm missing something on how to use functions for columns with
LOAD DATA INFILE ?

I'm afraid that the syntax states that you can only use a list of column
names.

I think the best you can do is make an extra varchar column to hold the raw
'date' value from the csv and use an extra query to convert it into a format
suitable for the gmtDate column.

Regards, Jigal.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to