MySQL Forums
Forum List  »  Newbie

Re: loading fixed row length text files
Posted by: atong
Date: July 08, 2005 09:54AM

Okay, I did alittle more research and here's what I found in the 13.2.5. LOAD DATA INFILE Syntax
(which can be found at: http://mysql.mirrors.redwire.net/doc/mysql/en/load-data.html)


If the FIELDS TERMINATED BY and FIELDS ENCLOSED BY values are both empty (''), a fixed-row (non-delimited) format is used. With fixed-row format, no delimiters are used between fields (but you can still have a line terminator). Instead, column values are written and read using the ``display'' widths of the columns. For example, if a column is declared as INT(7), values for the column are written using seven-character fields. On input, values for the column are obtained by reading seven characters.

LINES TERMINATED BY is still used to separate lines. If a line doesn't contain all fields, the rest of the columns are set to their default values. If you don't have a line terminator, you should set this to ''. In this case, the text file must contain all fields for each row.

Fixed-row format also affects handling of NULL values, as described later. Note that fixed-size format does not work if you are using a multi-byte character set.


So, I guess you just read it in with null values for FIELDS TERMINATED BY and FIELDS ENCLOSED BY. Looks like it's time to experiment! =)

Options: ReplyQuote


Subject
Written By
Posted
Re: loading fixed row length text files
July 08, 2005 09:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.