In the last episode (May 11), Thimble Smith said:
> On Thu, May 11, 2000 at 09:52:33AM -0700, CURTIS David wrote:
> > I have a text file that is delimited by length and I wish to import
> > it into mysql. I see in the manual that there is a good method for
> > comma delimited files. Unforunately this is not my case! Is there
> > a method for importing a file based on field lengths. Should I do
> > some grep magic - or import into a program that can add commas(,)
> > and quotes ("") around the fields. If this is well documented
> > somewhere, please direct me to the area
>
> MySQL won't import fixed-length fields. You might try something like
> this to fix it up:
Sure it will - here's a manual snippet:
* 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.
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 7-character
fields. On input, values for the column are obtained by reading 7
characters. Fixed-row format also affects handling of `NULL'
values; see below. Note that fixed size format will not work if
you are using a multi-byte character set.
So you just have to make sure that the field widths in your datafile
and your table match.
--
Dan Nelson
dnelson@stripped