Difference between revisions of "COPY TABLE"

From Lianjapedia
Jump to: navigation, search
(See Also)
(Description)
Line 9: Line 9:
  
 
==Description==
 
==Description==
The COPY TABLE command copies <sourcetablename> to <targettablename>.  Either filename can be substituted with an <expC>, enclosed in round brackets, which returns a valid filename.  If <targettablename> already exists, the original file is overwritten unless the IF NOT EXISTS clause is specified.  If <targettablename> does not exist and the IF EXISTS clause is specified, <targettablename> is not created.
+
The COPY TABLE command copies <sourcetablename> to <targettablename>.  Either filename can be substituted with an <expC>, enclosed in round brackets, which returns a valid filename.  If <targettablename> already exists, the original file is overwritten unless the IF NOT EXISTS clause is specified.  If < sourcetablename > does not exist and the IF EXISTS clause is specified, <targettablename> is not created.
  
 
The <tablename1> associated files: memo (.dbt), index (.dbx) and rules (.dbd) are also copied.
 
The <tablename1> associated files: memo (.dbt), index (.dbx) and rules (.dbd) are also copied.

Revision as of 22:52, 20 November 2023

Purpose

Copy a table to a new table along with its associated files

Syntax

COPY TABLE [<database>!]<sourcetablename> | (<expC>) TO [<database>!]<targettablename> | (<expC>) [IF [NOT] EXISTS]

See Also

ADATABASES(), ADD TABLE, ALTER TABLE, ALTER INDEX, CLOSE DATABASES, CLOSE TABLES, COMPARE DATABASE, COMPILE DATABASE, COPY Commands, COPY DATABASE, COPY FILE, CREATE DATABASE, CREATE INDEX, CREATE TABLE, CREATE VIEW, DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY SCHEMAS, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), LIST DATABASE, LIST INDEXES, LIST SCHEMAS, LIST TABLES, OPEN DATABASE, REMOVE TABLE, RENAME, RENAME Commands, RENAME TABLE, SET AUTOCATALOG, SET DATADIR, SET EXCLUSIVE, SET SQL, USE

Description

The COPY TABLE command copies <sourcetablename> to <targettablename>. Either filename can be substituted with an <expC>, enclosed in round brackets, which returns a valid filename. If <targettablename> already exists, the original file is overwritten unless the IF NOT EXISTS clause is specified. If < sourcetablename > does not exist and the IF EXISTS clause is specified, <targettablename> is not created.

The <tablename1> associated files: memo (.dbt), index (.dbx) and rules (.dbd) are also copied.

The <database>! prefix can optionally be specified for both the source and target tablenames.

From v9.4.8.

Example

open database southwind
copy table employees to staff
close data
copy table southwind!staff to sw!staff