Comments - LOAD DATA INFILE

3 years, 3 months ago Olivier Bertrand

Things are strange. My table: {code} create table tld ( id int not null, name char(32) not null, birth datetime) engine=MyISAM; {code} The file to load: {no format} 1,Grace Hopper,1906-12-09T05:00:00Z 2,Kristen Nygaard,1926-08-27T04:00:00Z 3,Ole-Johan Dahl,1931-10-12T04:00:00Z {no format} When I try: {code} load data infile 'C:/Data/tld.csv' INTO TABLE tld FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; {code} I get the error: 1292: Incorrect datetime value: '1906-12-09T05:00:00Z' for column `test`.`tld`.`birth` at row 1

Now when I edit the first record of the file to have: {no format} 1,Grace Hopper,1906-12-09 05:00:00 2,Kristen Nygaard,1926-08-27T04:00:00Z 3,Ole-Johan Dahl,1931-10-12T04:00:00Z {no format} I can load it with 2 warnings: 1265 Data truncated for column `birth` at row 2 1265 Data truncated for column `birth` at row 3

However, when I execute: {code} select * from tld; {code} It works fine and I get; {no format} +----+-----------------+-----------------------+

idnamebirth

+----+-----------------+-----------------------+

1Grace Hopper12/9/1906 5:00:00 AM
2Kristen Nygaard8/27/1926 4:00:00 AM
3Ole-Johan Dahl10/12/1931 4:00:00 AM

+----+-----------------+-----------------------+ {no format} So, even with a warning, row 2 and 3 have been accepted. Why not the first one?

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.