Chenzhou Cui wrote:

The file is in fix column width format. If it is in CSV format, I don't need a program to read it.

'load data infile' can import from a fixed-width format. Check the documentation. I've set up a number of these imports, and they're a little messy to set up ( you have to put details of the widths of columns IN THE TABLE DEFINITION, but it does work.

What I do is create a temporary table with the column widths in the table definition, 'load data infile' into it, and then use a 'insert into ___ select * from ___' query to move the data into the real table. If you've got a lot of rows, then maybe this isn't such a good idea, but you can *probably* get your column widths into your table without causing too much trouble.

Importing from fixed-width columns really is the weakest part of 'load data infile'. Perhaps a feature-request bug for a better solution is in order?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to