The copy statement allows you to do the following:
A special form of the copy statement is used to perform a fast copy of an entire table with no format changes.
No column names are specified in a binary copy. For example:
table emp ()
The entire table is moved, byte for byte, with no record delimiters or data type conversions.
One or more column names are specified in a formatted copy. For example:
table emp (eno=integer, ename=char(10))
Although this type of copy is not as fast as a binary copy, it allows you to fully control the columns copied, the column order, and the data type conversions to be performed.
When copying data to a table, the copy from statement can run in either of the following modes:
A bulk copy is a copy operation optimized for speed that allows the DBMS Server to exploit group writes and minimal transaction logging. Bulk copying is done whenever the characteristics of the target table allows. The bulk copy can be performed from any source file, either binary or formatted.
Doing a bulk copy from a binary file is the fastest method to copy large amounts of data.
In incremental mode, data is added to the table using inserts, causing single-page writes and full transaction logging. Incremental mode is used for the copy whenever the characteristics of the target table do not allow a bulk copy to be performed.
The copy statement itself does not require permissions to run. However, you must have permission to access the table being copied. At least one of the following must apply:
To copy data in and out of the database as quickly as possible, the copy statement does not check for:
When copying data into a table, copy ignores any integrity constraints (defined with the create integrity statement) against the table.
When copying data into a table, copy ignores ISO Entry SQL92 check and referential constraints (defined using the create table and alter table statements), but does not ignore unique and primary key constraints.
The copy statement does not fire any rules defined against the table.
For information on integrities, constraints, and rules, see the chapter "Ensuring Data Integrity."
When you use the copy statement, the locking system takes one of the following actions:
For a complete explanation of locking, see the chapter "Understanding the Locking System."