Jump to content

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


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.

 

:(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.