How to Import ASCII Files with Nonstandard Delimiters

ID: Q111922


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6x
  • Microsoft FoxPro for Macintosh, versions 2.5x, 2.6a


SUMMARY

When you are importing an ASCII text file that has delimiters other than a comma or a tab, specify the delimiter in the APPEND FROM command.


MORE INFORMATION

Example (using FoxPro 2.x Sample Tables)

  1. Create an ASCII text file by typing the following command in the Command window:
    
          MODIFY COMMAND test.txt 


  2. In the TEST.TXT window, type in the following:
    
          |4444|,|44444|,|12/01/93|,|444.44|,|444|
          |5555|,|55555|,|12/02/93|,|555.55|,|555|
          |6666||666666||12/03/93||666.66||666|
          |7777||777777||12/04/93||777.77||777|
          8888,|44444|,19931217,444.44,|444|
          9999,|55555|,19931215,555.55,|555|
          4545,45454,|12/01/93|,444.45,454
          5656,56565,19931202,565.65,565 
    Notes


    • To create the pipe character ("|"), press SHIFT+BACKSLASH (\).


    • In this example, the pipe character is used as a field delimiter and the comma is used as a field separator. Using DELIMITED WITH TAB yields tab field delimiters and DELIMITED WITH BLANK yields space field delimiters. The field delimiter characters are used only to surround the field data, and the field separator characters will remain commas.


  3. Save the file.


  4. From the File menu, choose Open. Under List Files Of Type, select Table/DBF, and then select INVOICES.DBF from the TUTORIAL subdirectory.


  5. In the Command window, type the following:
    
          APPEND FROM TEST.TXT TYPE DELIMITED WITH | 
    Eight records should be added to the database.


Additional query words: VFoxWin FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.50c 2.60 import

Keywords : FxprgGeneral
Version : 2.00 2.5x 2.6x | 2.5x 2.6x 3.00
Platform : MACINTOSH MS-DOS WINDOWS
Issue type :


Last Reviewed: August 24, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.