Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing data from fixed width files
Message
From
28/09/2001 18:10:16
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00562162
Message ID:
00562167
Views:
20
Hi Rip

APPEND FROM DELIM may work depending on what your data delimiter between fields is is.
However I often do it the following way.

First I create a table with 1 very long field (longfld) in it big enough to contain all the fields in your textfile.

Then do

APPEND FROM MYTEXTFILE.TXT SDF

Now all you data is in a table but its all in the one field so all you have to do is add your own field names to the structure and then something like the following

REPLACE all NAME with SUBS(LongFld,1,10), Address1 with SUBS(Longfld,11,20)

etc etc You get the idea

Hope this helps

>I have a dbf table with no records and it's structure matches a fixed width text file. Meaning, for example, if field1 is a c(6) and field2 is a c(10) then, in the text file, columns 1-6 are field1 and columns 7-17 are field2.
>
>What would be the best way to import this data?
>
>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform