COPY STRUCTURE EXTENDED

From Lianjapedia
Revision as of 05:10, 17 August 2015 by Yvonne.milne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Purpose

Create a table with records containing field definitions

Syntax

COPY STRUCTURE EXTENDED TO <.dbf filename> | (<expC>) [FIELDS <field list>]

See Also

COPY, COPY FILE, COPY STRUCTURE, CREATE FROM, REPLACE

Description

The COPY STRUCTURE EXTENDED command operates on the currently active table and creates a new table with records containing the active table's structure. The new table has five fields:


Field Type Length Description
FIELD_NAME Character 32 Field name
FIELD_TYPE Character 1 Data type
FIELD_LEN Numeric 3 Width of field
FIELD_DEC Numeric 3 Number of decimal places
FIELD_DES Character 25 Field description


A record is created for each field from the active table, so that each record contains a complete field definition. Once a table has been created in this manner, it can be used to build a new table structure. The records containing the field definitions can be modified in the same way as any standard records (EDIT, REPLACE etc). The CREATE FROM command can then use this structure table as the source for a new table.

TO <.dbf filename>

The TO <.dbf filename> can be substituted with any <expC>, enclosed in round brackets, which returns a valid filename.

FIELDS <field list>

If the optional FIELDS clause is specified, then the operation is restricted to those fields named in the comma separated <field list>.

Note: if a database is open, the table will be created in the database. Tables with names starting with an underscore are not added to the currently open database.

Example

use patrons
copy structure extended to patstru
select workarea()
create newpatrons from patstru