Jump to content

How to import a white space delimited text file using LOAD DATA INFILE ?


Zojak_Quaguz

Recommended Posts

This one perplexes me. I can't find anything in the documentation about it, and I would be surprised if MySQL doesn't include functionality for such a simple task.

 

LOAD DATA INFILE 'blah.txt' INTO TABLE blah FIELDS TERMINATE BY ' ' LINES TERMINATED BY '\n';

 

example file:

 

83726291 4

92923612 1

42093723 0

12321742 1

91283747 2

01249243 4

 

It keeps loading the entire line into a single field, so my table ends up with column 2 being NULL.

 

:(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.