PRB: CREATE FROM Command Ignores Indexes and Filters

ID: Q109578

The information in this article applies to:

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:

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

Last Reviewed: June 27, 1995