Export Table to fixed length txt file

D

David

I have three tables- a header (10 columns- 1 row)- main body (40 columns-
many rows) and a trailer (12 columns - one row)

I need to export all three to fixed length text file where the end of line
character needs to be in a particular position (different for the three
elements) say position 1500 for the main body- 250 for the header / trailer
Any help in best way to joing them to one txt file in format required would
be great.
 
J

Jack Leach

This may not be the best solution, but it should do the trick.

Make a temp table with all text fields set the the fixed length you require.

Run an query to populate the temp table from your main table (include any
conversion functions required).

Run a query to update the now populated temp table setting the format to fix
the length of string to what you require.

You would ideally now have a table that has all of the data in string
format, formatted to fixed lengths, and an export from there to your text
file should do it.

I don't know the details off the top of my head, but I know it's possible to
do each step, so you could try it like that. Don't expect it to be very
quick though.

hth


--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top