|
|
Question : Can't import dates in csv into MySQL database
|
|
Hello all..
I will be creating a csv file monthly and would like to import the data into a MySQL database to run reports off it.
Currently, I run the report, but the date is imported as 0000-00-00. I figured this was because the default date format was dd/mm/yyyy. I altered those to read as yyyy/mm/dd as mysql likes it, although I'd rather not have to do that, it would simplify the process (I'll be handing the process over in 2 months to someone else). They still showed as 0000/00/00 in the database. The data type of the CallDate field is date.
I'm running the following mysql query: LOAD DATA LOCAL INFILE 'c:/september.csv' INTO TABLE calls FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (ITime,CallDate, CO, Tenant, IDuration, Extension, TrunkGroup, Account, Transfer, Price, CurrencyID, Number, ProviderStatus, Preflen1, Preflen2, CallType, ZoneID, MeterPulse, RingBefore, TrfGroup, CallerId, Hand, cTime, cDuration, cExtension, cCO, cNumber);
Shown below is a sample line from csv file I would like to use: : 31560,01/09/2008,"12","",45,"168","","0000","",0.05,1,"9123456","Local",0,0,"C",0,0,0,1,"","",,"08:46:00","0:00:45","168","12"
Any advice on how to proceed would be greatly appreciated.
|
Answer : Can't import dates in csv into MySQL database
|
|
Try putting quotes around the dates ("01/09/2008").
-Chuck
|
|
|
|
|