Tag Info

New answers tagged


You can refer HERE using perl on *nix: You can use perl to replace the death lines to any delimiter you want (I used comma in this example). File: Command: perl -wnlpi -e 's/\s+/,/g;' text.txt Result:


Ok, firts thanks all for your help. I managed to solve the problem by simply setting the last column to "varchar(10)". It turns out that integer columns can not accept blank values.


To set NULL you just need your table to have allow nulls. If you want to change it to some default value in case of nulls/missing values, you need to specify individual column names as below: LOAD DATA INFILE "/home/mycsv.txt" INTO TABLE inbound.master_data FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n' ...


Since the link that I created in the comments did not contain this particular method, I figure I would throw it in here. Besides the approaches mentioned here I went ahead and tried this approach as another way that would take very little change to a package that is going through a ForEach Loop (since that is how I did it in mine). What you would do, is ...

Top 50 recent answers are included