Home > database >  The load data infile
The load data infile

Time:09-19

I use the load data infile import a CSV, when all fields are empty will import the success, but when a field is empty import errors, is this why? How to solve? The data fields in the table can be null,

CSV no blank field is as follows:

JiaoFeiRen name, should capture to expend amount, payment status, payment time, payment amount, owe the amount
A thin, hu,0,2017 800/5/1 20:00, 800, 0
Zhang Yike, 800,1,2017/5/1 20:00, 800, 0
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
CSV with blank fields is as follows:

JiaoFeiRen name, should capture to expend amount, payment status, payment time, payment amount, owe the amount
A thin, hu 800,0,2017/5/1 PM, 0
Zhang Yike, 800,1,2017/5/1 20:00, 800, 0

SQL statements below
The load data infile
'/Library/WebServer/Documents/JFPT/Public/Upload/break/chargeitems_611000065_144761 CSV'
Into the table bank_chargeitems_51_36
Fields terminated by ', 'lines terminated by' \ r \ n 'IGNORE 1 lines


In addition:
Don't understand the load data infile and load data local infile difference, to introduce it to me? And when using the load data local infile, the above example, there are blank fields can be imported

CodePudding user response:

Without local and import the data requirement documents must be in mysql server, with the local don't have to
  • Related