[CLUE-Talk] Import large fixed length records into mysql (in a single pass)?

dave price dp_kinaole at yahoo.com
Fri Oct 8 01:31:01 MDT 2004


Good morning,

I have a need to process files with a 'fixed length'
structure and, ideally insert the data into a mysql
table in 'more or less' a single step.

The data is one record per line, but rather than any
delimiter, we just know the character positions of
each field in the line. i.e.:

position  length   field_name
========  ======   ==========
   1         4     field_1
   5         10    field_2
   11        10    field_3

 ... etc ...

what makes it a bit harder is that:

1> The length of each record is 778 characters, so I
don't think I can import the input file into a single
char() type for subsequent processing.

2> The client computer that uploads the data may not
be *nix based, and may lack tools to do any
'pre-processing' of the data.

3> I would like to make this as automagic as possible.

In the x-base world I know I can define a table with
the right sized char() type in the right order and use
an: "append from <filename> type SDF" syntax to
import.

Is there a similar 1-step mechanism for fixed length
records in SQL or mysql?

Is there a nice *nix filter that can convert the
fixed-length records into by placing delimiters where
they are needed?

If anyone cares to see the complete x-base solution
... I have it written and tested,  but I am really
trying to move this application away from x-base and
to a more modern tool-set

Thanks for your ideas.

aloha,
dave


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 



More information about the clue-talk mailing list