MySQL Forums
Forum List  »  Newbie

LOAD DATA INFILE from csv file
Posted by: Sachin G
Date: October 05, 2011 06:13PM

Hi All,

I have a csv file which has time stamp as one of the column (8/31/2011 15:51 format is m/dd/yyyy hh:MM). I am trying to load this csv file into mysql table using LOAD DATA INFILE. The table has a column name Test_Time with datetime as type. When i execute the following sql

LOAD DATA INFILE 'C:\\Share\\Results\\ResultsData.csv'
INTO TABLE test.results
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES;

i get following error..

ERROR 1292 (22007): Incorrect datetime value: '3/28/2011 10:21' for column 'Test_Time' at row 1.

I suspect this error is due to type mismatch.

How do I resolve the error? Do i need to type cast, if so can you please give me some pointers?

Thank you in advance.

Sachin

Options: ReplyQuote


Subject
Written By
Posted
LOAD DATA INFILE from csv file
October 05, 2011 06:13PM
October 06, 2011 05:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.