PRB: After SELECT-SQL FoxPro Deletes Compound Structural Index

Last reviewed: June 27, 1995
Article ID: Q107838
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a, and 2.5b

SYMPTOMS

If you issue an SQL SELECT statement that outputs to a database file that has a compound structural index attached to it, the index is deleted from the disk drive. The new database file will not contain any reference to the compound structural index.

CAUSE

When an SQL SELECT statement outputs to an existing database, FoxPro re-creates the entire file. Since the header record of the database file is created anew, no reference to the compound structural index is retained. FoxPro displays a warning that it will overwrite the current database file. FoxPro deletes the file to eliminate the possibility of retaining a compound structural index that contains tags that may not match the new database structure.

RESOLUTION

To retain the index file on the target database after performing the SQL SELECT statement, do one of the following:

  • Instead of using a structural compound index, create a nonstructural compound (compact) .CDX index file. This index will have a different name from the database.

    -or-

  • Use an .IDX index file with the database.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In the Command window, issue the following commands:

          USE CLIENTS.DBF
          COPY TO XCLIENTS.DBF
          USE XCLIENTS.DBF
    

  2. From the Database menu, choose Setup.

  3. Create a compound structural index with a tag on the State field.

  4. In the Command window, issue the following commands:

          USE CLIENTS.DBF
          SELECT * FROM CLIENTS INTO TABLE XCLIENTS.DBF
    

  5. A warning message appears saying the target database already exists and asks if you want to overwrite XCLIENTS.DBF. Choose Yes.

  6. In the Command window, type:

          DIR XCLIENTS.*
    

The XCLIENTS.CDX file no longer exists on the disk.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.50b
KBCategory: kbprg kbprb
KBSubcategory: FxprgSql


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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.