I suggest writing a PERL script/filter which accepts the text file and sends
a comma-delimited file to standard-out.  This file could then be sucked in
by mysql


-----Original Message-----
From: Michael Benbow [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 7:48 PM
To: [EMAIL PROTECTED]
Subject: Problem with LOAD DATA INFILE



Hello all,

I have a problem.  I am able to get a copy of a text file which resides
on another server for a task I am completing.  What I need to do is
import this text into a database table on a nightly basis, and I am
trying to set this up via PHP so it is all automated.  I have one
problem though, and that is the format of the text file.

The text file is not comma delimited or tab delimited, but it is a fixed
format with each column spaced out evenly.  I created a table with the
same lengths as each field from the text file then I used the following
line:

LOAD DATA INFILE '/path/to/file.txt' INTO TABLE table_name IGNORE 1
LINES;

This inserted the first field correctly but all other fields are NULL.
If the file is tab delimited or comma delimited I'd have no problems,
but since it isn't I am completely stuck...

PLEASE HELP ME!!!

Thank you,
Michael.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to