I need to format a date so it gets imported correctly into a database....
In the text files the 2 date columns contain data like 12/12/2005 and 12/12/05.
MySQL likes 2005-12-12 as you know so nothing gets imported. I tried to do something but I don't know what to do since this is giving me an error when I try to execute.
LOAD DATA LOCAL INFILE 'H:\\file\\location.txt'
INTO TABLE table
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY """"
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(
DATE_FORMAT(DATEPULL, '%Y-%m-%d') AS DATEPULL,
ACTNUM,
TERMID,
TRANCODE,
DESCRIPTIONS,
TRANDATE,
CHANGEFROM,
CHANGETO
)
This works but the date's are all messed up
LOAD DATA LOCAL INFILE 'H:\\file\\location.txt'
INTO TABLE table
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY """"
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(
DATEPULL,
ACTNUM,
TERMID,
TRANCODE,
DESCRIPTIONS,
TRANDATE,
CHANGEFROM,
CHANGETO
)
Anybody know what I should do to format them?