Microsoft KB Archive/156773

= PRB: COPY TO TYPE DELIMITED Differs in Various FP Versions =

Article ID: 156773

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q156773



SYMPTOMS
In Visual FoxPro 5.0, the COPY TO DELIMITED WITH BLANK command places quotation marks around character fields and preserves leading blank spaces within character fields. Other versions of FoxPro create text files that are slightly different in their format. You should be aware of the possible differences if you use this command under a previous version of FoxPro to port to Visual FoxPro 5.0.



WORKAROUND
If the character fields do not need quotation marks around them, use the COPY TO TYPE SDF command.



STATUS
This behavior is by design.



MORE INFORMATION
Different versions of FoxPro produce slightly different text files using the same command. Depending on the version, leading spaces may be truncated or quotation marks may be added to character fields. For example, COPY TO DELIMITED WITH BLANK in FoxPro 2.6a for Windows produces a text file that does not contain quotation marks around the character fields. If a character field contains leading spaces, they remain. However, Visual FoxPro 3.0b exhibits different behavior. The text file contains no quotation marks around the character fields and leading spaces are trimmed from the fields.

Visual FoxPro 5.0 produces a text file that preserves leading spaces and places quotation marks around each character field. This is the intended behavior of the product.

The following text comes from the "COPY TO" Help file topic:

DELIMITED Creates a delimited file. A delimited file is an ASCII text file in which each record ends with a carriage return and linefeed. The default field separator is a comma. Since character data may include commas, character fields are additionally delimited with double quotation marks.

Steps to Reproduce Behavior
  Create a table in the Command window by typing: CREATE TABLE test (ctest C (30))   In the Command window, type the following commands: INSERT INTO test (ctest) VALUE ('This is a test') INSERT INTO test (ctest) VALUE ('   This is another test') INSERT INTO test (ctest) VALUE ('  This is a third test')   Create a text file by typing the following command in the Command window: COPY TO test.txt DELIMITED WITH BLANK   Open the text file by typing the following in the Command window: MODIFY COMMAND test.txt 

Note that the leading spaces are preserved and each field is surrounded by quotation marks.

Additional query words: VFoxWin kbdsd

Keywords: KB156773

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.