I noticed that I can insert multiple NULL values into a table with a UNIQUE key :
INSERT INTO table (autoincrementkey, uniquekey, id) VALUES (NULL, NULL, 0), (NULL, NULL, 1), (NULL, NULL, 2)
This works fine as I get the 3 lines inserted (and yes, the uniquekey is NULL = Yes)
However, when I try to use the Load Data from a file with the same query, it only inserts 1 NULL value, which is the first.
LOAD DATA LOCAL INFILE $file.csv INTO TABLE table FIELDS TERMINATED BY ',' ENCLOSED BY '"'
Is there any way I can insert multiple NULL values on a UNIQUE column, with the LOAD DATA INTO please ?
Thanks in advance!
=============
[UPDATE]
I noticed that uniquekey gets a 0 instead of a NULL, which is why only the 1st entry gets to the database. In the CSV file it looks like this :
,,1
,,2
,,3
But uniquekey is set to NULL by default, I don't get why it gets 0 :
ALTER TABLE `table` CHANGE `uniquekey ` `uniquekey ` INT(10) DEFAULT NULL;
[UPDATE 2]
OK I got it!! I thought (,,1) would insert NULL, NULL, 1. But it's not true, it has to be (NULL,NULL,1) to get what you see.