Finding a utility to import fixed field data

I need to import fixed-field data into MySQL. I could use Microsoft Access to import it, then export it as a tab-delimited ASCII file to then be imported into MySQL. However, my IT shop is seeking an open source solution. Is there an open source utility that allows the importing of fixed-field (or column de-limited) data into MySQL?

    Requires Free Membership to View

MySQL can read fixed-width and de-limited files directly using the LOAD DATA INFILE command. The LOAD DATA INFILE command can be used to read data files located on either the server or the client (with the LOAD DATA LOCAL INFILE syntax), using any delimiters you specify or fixed-width.

The full syntax of LOAD DATA INFILE is available here. This is one example of reading a comma-delimited file:

LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
  FIELDS TERMINATED BY ',' ENCLOSED BY '"'
  LINES TERMINATED BY 'n';

LOAD DATA INFILE is generally quite fast. In my experience, I have seen it load three million rows in roughly ten seconds.

This was first published in May 2006

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.