I have a MYSQL database containing a bunch of fields, many of which are configures as numerical values, either:
thickness
double(7,2) DEFAULT NULL,
or
has_input
tinyint(4) DEFAULT NULL,
I have to import a csv file into this table and have been using
load data local infile 'myfilepath/file.csv' into table
combined
fields terminated by ',' enclosed by '"' lines terminated by '\r\n';
but all numerical fields are having null values replaced by zero. This is really annoying as some fields have a legitimate value of zero and I need to be able to distinguish these from the fields with no value.
As you can see above, the field defaults are set to null and, on other advice, I've entered \N in all the blank fields in the csv to indicate null.
Nevertheless, the nulls are still being replaced with zero. Can you help?