Question about LOAD INTO on a table with an auto increment primary key.

Hey,

I'm trying to execute the following query:

LOAD DATA LOCAL INFILE filepath
INTO TABLE tablename
FIELDS TERMINATED BY "/t"
LINES TERMINATED BY "/n"

However, when I execute this for a table that has an auto increment key I get nothing but skipped rows. If I execute show warnings;MySQL returns an empty result set. This query works fine on every other table.

Unfortunately I can't provide a table schema as it's a violation of my NDA, but if you have questions I'll try to be as specific as possible. Any help is appreciated!

Edit:

After further research I found that it's because I'm loading null values into a unique column, but every time I load null, it literally loads the string "null", so once record gets loaded and the rest get skipped. So, to redo the question, how do you load null values?

Edit 2:

And solved my own problem. The solution was to make every null field be \N, that tells mysql that you're trying to load null into a column. Thanks all!

Posted Sep 11, 2016, 10:42 PM UTC · edited

40
Loading comments…