COPY STRUCTURE EXTENDED Command

Example   See Also

Creates a new table with fields containing the structure of the currently selected table.

Syntax

COPY STRUCTURE EXTENDED TO FileName
  [DATABASE DatabaseName [NAME LongTableName]]
  [FIELDS FieldList]

Arguments

FileName

Specifies the new table to create.

DATABASE DatabaseName

Specifies a database to which the new table is added.

NAME LongTableName

Specifies a long name for the new table. Long names can contain up to 128 characters and can be used in place of short file names in the database.

FIELDS FieldList

Specifies that only the fields specified in FieldList are included in a record in the new table. If you omit FIELDS FieldList, all fields have a record in the new table.

Remarks

Information about each field in the currently selected table is copied to a record in the new table. The structure of the new table is fixed in format and consists of sixteen fields. The following table lists the names of the 16 fields and their contents.

Field Field type Contents
FIELD_NAME Character Field names from selected table (128 characters wide)
FIELD_TYPE Character Field types:
C = Character
Y = Currency
N = Numeric
F = Float
I = Integer
B = Double
D = Date
T = DateTime
L = Logical
M = Memo
G = General
FIELD_LEN Numeric Field widths
FIELD_DEC Numeric Number of decimal places in numeric fields
FIELD_NULL Logical Field null value support
FIELD_NOCP Logical Code page translation not allowed (character and memo fields only)
FIELD_DEFA Memo Field default values
FIELD_RULE Memo Field validation rules
FIELD_ERR Memo Field validation text
TABLE_RULE Memo Table validation rule
TABLE_ERR Memo Table validation text
TABLE_NAME Character Long table name (first record only)
INS_TRIG Memo Insert trigger expression (first record only)
UPD_TRIG Memo Update trigger expression (first record only)
DEL_TRIG Memo Delete trigger expression (first record only)
TABLE_CMT Memo Table comment (first record only)

You can modify the newly created table and then use CREATE FROM to create a new table with a different structure. COPY STRUCTURE and CREATE FROM allow you to programmatically change the structure of a table.

The width of the FIELD_NAME field is 10 characters in previous versions of Visual FoxPro, FoxPro for Windows, and FoxPro for MS-DOS. To use CREATE FROM with a table created by COPY STRUCTURE EXTENDED in Visual FoxPro 5.0 and earlier, you must change the width of the FIELD_NAME field to 10 characters. Note that some field types are not supported in Visual FoxPro 3.0 and earlier versions.