COPY STRUCTURE

From Lianjapedia
Jump to: navigation, search

Purpose

Copy the structure of the active table to another table

Syntax

COPY STRUCTURE TO <filename> | (<expC>)

[FIELDS <field list>]

[[WITH] CDX | [WITH] PRODUCTION]]

See Also

COPY, COPY FILE, COPY STRUCTURE EXTENDED, CREATE FROM

Description

The COPY STRUCTURE command creates a new empty table file with the same structure as the active table. The dictionary is also copied if one exists. The TO <filename> can be substituted with any <expC>, enclosed in round brackets, which returns a valid filename. This file will be created or, if it already exists, will be overwritten. If no file extension is specified, then the target file will have an extension of '.dbf'.

If the active table is encrypted, the encryption information will be copied to the target table. A .dkf encryption key file will be created for the target table and the correct three-part DES3 encryption key must be specified before the table can be accessed. A different key can be specified for the new table by including the new encryption key in the <filename>. The three part comma-separated key should be enclosed in angled brackets and appended to the filename, e.g. mytable<key_1,key_2,key_3>. This syntax can also be used to encrypt the new table when the source table itself is not encrypted.

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>. Dictionary entries are only copied for the specified fields.

WITH CDX | WITH PRODUCTION

The [[WITH] CDX | [WITH] PRODUCTION]] clause causes tag expressions in the currently active multiple index file to be copied to an empty .cdx/.dbx file with the same basename as the TO <filename>.

Example

use patrons
copy structure to namelist;
  fields name, street, city, state
 
// make an encrypted copy of the structure
use patrons
copy structure to enc_patrons<key_1,key_2,key_3>