FIX: COPY TO Incorrectly Copies All Fields to New Database

Last reviewed: October 20, 1997
Article ID: Q115264
2.60 WINDOWS kbprg kbfixlist kbbuglist kbcode

The information in this article applies to:

  • Microsoft FoxPro for Windows, version 2.6

SYMPTOMS

After you issue a SELECT-SQL command that selects specific fields from a table into a cursor, the COPY TO command will incorrectly copy ALL of the fields from the original table into the new table.

NOTE: This also occurs with a query produced by the Relational Query By Example (RQBE) window.

RESOLUTION

There are two workarounds you can use to get the desired results. Either workaround results in table TEMP1 correctly containing only the CNO and CITY fields.

Workaround 1

Send the results of your SELECT-SQL command to a table rather than a cursor. For example:

   ***Begin Code Example***
   SELECT cno,city from customer into TABLE temp1
   USE temp1
   BROWSE
   ***End Code Example***

Workaround 2

Use SET FIELDS to have only CNO and CITY available. For example:

   ***Begin Code Example***
   SELECT cno,city FROM customer INTO CURSOR temp
   SET FIELDS to cno,city
   COPY TO temp1
   USE temp1
   BROWSE
   ***End Code Example***

MORE INFORMATION

When the COPY TO command works correctly, it copies only the fields from the table in the current work area. The table in the current work area can be either a cursor or table.

However, in FoxPro 2.6 for Windows, if the table in the current work area is a cursor, the COPY TO command copies all the fields that are in the cursor's source table.

The following code example illustrates this behavior:

   ***Begin Code Example***
   SELECT cno,city from customer into CURSOR temp
   COPY to temp1
   USE temp1
   BROWSE
   ***End Code Example***

The TEMP1 table incorrectly contains all the fields that are in the CUSTOMER table.


Additional reference words: FoxWin 2.60 specific some few limit buglist2.60
fixlist2.60a
KBCategory: kbprg kbfixlist kbbuglist kbcode
KBSubcategory: FxtoolRqbe
Keywords : FxtoolRqbe kbbuglist kbcode kbfixlist kbprg
Version : 2.60
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 20, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.