PRB: CREATE FROM Command Ignores Indexes and Filters

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

SYMPTOMS

Indexes or filters set to a database created either manually or with the COPY STRUCTURE EXTENDED command will be ignored when you are using the CREATE FROM command.

RESOLUTION

There are three ways to work around this behavior:

  • Use the SORT command.

    -or-

  • Copy the fields to an array, perform an ASORT on the array, and then create the table from the array.

    -or-

  • Use an SQL SELECT command with an ORDER BY clause to sort the fields. (For an example of this, see "Workaround" in the "More Information" section below.)

MORE INFORMATION

Steps to Reproduce Behavior

The following steps use the CUSTOMER.DBF from the TUTORIAL subdirectory under the main FoxPro directory.

Issue the following commands from the Command window or copy them into a program (.PRG) file and run the program file:

   USE customer
   COPY STRUCTURE EXTENDED TO test
   USE test
   INDEX ON field_name TAG field_name ADDITIVE
   SELECT 0
   CREATE result FROM test
   LIST STRUCTURE

The field names are not in ascending order. The field name CNO is before the COMPANY and CONTACT fields.

Workaround

In order to have the fields sorted, use the following code:

   USE customer
   COPY STRUCTURE EXTENDED TO test
   USE test
   SELECT * FROM test ORDER BY field_name INTO TABLE query
   SELECT 0
   CREATE result FROM query
   LIST STRUCTURE


Additional reference words: FoxMac FoxDos FoxWin 2.00 2.50 2.50a 2.50b 2.60
pssbug2.50b
pssbug2.60
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.