I am scanning 5000 csv files into a database. Regrettably the files have '', for 0. Thus when ever I run my script it crashes. I heard that this error is possible to avoid by simply disabling strict mode. So I attempted to disable strict mode to allow me to read in an empty string as a 0 for my numeric fields. However the error persisted.
So does disabling strict mode allow '' to be read into a int field? (the '' is two qoutes i.e. empty string)
If so why did setting
sql_mode=''
in the my.ini config file not fix the problem.
Thank you!
I guess you import the CSV file using LOAD DATA INFILE
command. Before you execute this command, type:
SET sql_mode = '';
More information about various SQL modes can be found in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With