You can use LOAD DATA INFILE if you have sufficient privileges on the server
and the file format is acceptable.  If not, it's pretty simple to do some
text manipulation and convert text into a multi-line INSERT statement:

INSERT INTO tabl
(col1, col2, col3)
VALUES
('11', '12', '13'),
('21', '22', '23'),
('31', '32', '33'),
.....
('n1', 'n2', 'n3)

Basically, it goes like this: replace all "'" with "\'", add "('" to the
start of every line, add "')" to the end, replace "," with "','", prepend
the INSERT .... VALUES stuff, and then remove the trailing comma.

Cheers,
barneyb

> -----Original Message-----
> From: Mickael [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 13, 2004 12:06 PM
> To: CF-Talk
> Subject: Import a Text file to MYSQL
>
> Hello All,
>
> Can you import a text file to MYSQL with CF.  I would like to
> take a text file that is exported to Access then Drop/Create
> the table with CF in MYSQL then import the file in its
> entirety to create the table.
>
> This sounds simple enough in theory, how can this be done in
> CF and MYSQL I don't really have any experience with MYSQL
>
> Thanks in advance
>
> Mike
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to