COPY STRUCTURE Command
Creates a new, empty table with the same structure as the currently selected table.
COPY STRUCTURE TO TableName [FIELDS FieldList] [[WITH] CDX | [WITH] PRODUCTION] [DATABASE cDatabaseName [NAME cTableName]]
Specifies the name of the new, empty table to create.
In Visual FoxPro, null value support and the code page for the new, free table are identical to the currently selected table.
- FIELDS FieldList
Specifies that only the fields whose names are specified in the FieldList are copied to the new table. If you omit FIELDS FieldList, all fields are copied to the new table.
- [WITH] CDX | [WITH] PRODUCTION
Creates a structural index file for the new table that is identical to the structural index file of the existing table. The tags and index expressions from the original structural index file are copied to the new structural index file.
The CDX and PRODUCTION clauses are identical.
In Visual FoxPro, a primary index for the currently selected table is converted to a candidate index for the new empty table.
- DATABASE cDatabaseName
Specifies the name of an existing database to which the new table is added. Note that the table and field properties are not copied to the database.
- NAME cTableName
Specifies the name of the table as it appears in the database.
In the following example, the customer table is opened, its structure is copied to a table called backup and backup is opened. APPEND FROM then appends records to the backup table from the customer table, and a Browse window is opened for the backup table.
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE customer && Opens Customer table COPY STRUCTURE TO backup USE backup APPEND FROM customer FOR country = 'UK' BROWSE FIELDS contact, country USE DELETE FILE backup.dbf