1 month, 1 week ago Olivier Bertrand
This comment has the status of 'removed' and can only be seen by you.

Things are strange. My table:

create table tld ( id int not null, name char(32) not null, birth datetime) engine=MyISAM;

The file to load:

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

When I try:

load data infile 'C:/Data/tld.csv' INTO TABLE tld FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

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 just the first record of the file to have:

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

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:

select * from tld;

It works fine and I get;




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


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.