importing using LOAD DATA INFILE
Hello
I am in middle of transferring data from Oracle tables to MySQL (5.1.37). I have a flat file with 3 columns in it...
"XXXX",3/18/1998,3/3/2004 3:28:59 PM
"YYYY",3/23/1998,3/3/2004 3:29:01 PM
"ZZZZ",5/18/1998,3/3/2004 3:30:45 PM
"AAAA",5/19/1998,3/3/2004 3:30:47 PM
The destination table in MySQL looks like this...
+---------------+-------------+
| Field | Type |
+---------------+-------------+
| SOMEXX_ID | varchar(20) |
| SUBMIT_DATE | date |
| CREATION_DATE | timestamp |
+---------------+-------------+
And, here's the load command i used...
LOAD DATA INFILE '/data-dump/TEST.txt'
INTO TABLE DATE_TEST
FIELDS TERMINATED BY ',' optionally enclosed by '"' lines terminated by '\n'
(SOMEXX_ID, @var1, @var2)
SET SUBMIT_DATE = date_format(str_to_date(@var1, '%m/%d/%Y'), '%Y-%m-%d'),
CREATION_DATE = date_format(str_to_date(@var2, '%m/%d/%Y %l:%i:%s %p'), '%Y-%m-%d %l:%i:%s %p');
All the rows were imported successfully into MySQL table, the data checkout ok, but it had a bunch of warning....
+---------+------+-----------------------------------------------------+| Level | Code | Message |+---------+------+-----------------------------------------------------+
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 1 |
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 2 |
| Warning | 1265 | Data truncated for column 'CREATION_DATE' at row 3 |
.....
.....
.....
I am not able to figure out why there are warnings even though the data was imported successfully and the data looked accurate.
Can someone please advise?
Thanks
sid