I'm importing a CSV into a MySQL table with
LOAD DATA INFILE
Incorrect integer value: '' for column 'contributor_zipcode' at row 180
contributor_zipcode INT DEFAULT '0'
contributor_zipcode INT DEFAULT NULL
The empty values are being interpreted as the empty string (''), not NULL, so the default value is not being used.
If you want to explicitly control the handling of these empty strings, the best thing to do is to load them into a user variable, and then set the column conditionally using the user variable.
You could use this to set the value to whatever you want (NULL, 0, etc.).
Here's an example, assuming you want to set it to 0:
LOAD DATA INFILE '...' INTO TABLE your_table FIELDS TERMINATED BY ',' (column_one,..., @contributor_zipcode,..., column_n) SET contributor_zipcode = IF(@contributor_zipcode='',0,@contributor_zipcode);