How to Import ASCII Files with Nonstandard Delimiters (111922)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft FoxPro for MS-DOS 2.0
  • Microsoft FoxPro for Macintosh 2.6a

This article was previously published under Q111922

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.

Modification Type:MajorLast Reviewed:11/17/2003
Keywords:KB111922