Converting to Fixed File Length

GotIssues

Golden Member
Jan 31, 2003
1,631
0
76
I'm in a bit of a pickle and figured someone here might be able to help me out.

I need to create a fixed file length document for work, and I was wondering if there is a way to convert an Excel file (or text file) into a text file with a fixed file length format file. At this time, I do not have the SQL programming experience to pull directly from the DB into a fixed file format, but I can get it into a txt or xls file easily. I'd prefer to convert from xls to fixed file, as it's easier to ensure proper data before conversion. Thanks for your help
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,251
3,846
75
"fixed file length"? That would tend to limit the total amount of data that could be in those files, wouldn't it?

<Google>Did you mean, "fixed record length"?</Google>

Edit: I just checked Excel, and to save in a fixed-width text format, save as type "Formatted Text (Space delimited) (*.prn)". It doesn't actually tell you the widths, but hopefully they're easy enough to figure out.
 

KLin

Lifer
Feb 29, 2000
29,500
125
106
SELECT CAST(Field#1 AS Char(20)) As Field1,
CAST(Field#2 AS Char(20))As Field2
from tblTest

If you're using query analyzer, you can tell it to show the results in text. That should get you a fixed record length file.
 

GotIssues

Golden Member
Jan 31, 2003
1,631
0
76
Originally posted by: KLin
SELECT CAST(Field#1 AS Char(20)) As Field1,
CAST(Field#2 AS Char(20))As Field2
from tblTest

If you're using query analyzer, you can tell it to show the results in text. That should get you a fixed record length file.

Sweet, this is exactly what I was looking for. Thanks!