SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-156
CREATE TABLE Statement
You can use the CREATE TABLE command with the LIKE option to create a table
with a similar schema as a partition of an existing table. You can also use the
PARTITION clause with LIKE to create a partitioned table where all partitions of the
new table will be like the specified partition of the original table. Each partition of
the new table will be created using the same partition format as the specified
partition of the original table. You cannot use the FORMAT clause to override the
format.
For example, suppose that you have a two partition; Format 2 enabled table with a
Format 1 primary partition and a Format 2 secondary partition. If you specify the
primary partition as the template in a CREATE TABLE LIKE command, all
partitions of the new table will be Format 1. If, instead, you specify the secondary
partition as the template, all partitions of the new table will be Format 2. In either
case, the new table will also be Format 2 enabled.
SQL does not apply partitions, views, indexes, or owner information from the
source table to the created table. (The SQLCI DUP command applies partitions
and owner information to a duplicate copy of a table and optionally duplicates
views and indexes of the table.)
source-table is the name of an existing table (or an equivalent DEFINE).
col-def
defines a column in the table by specifying the name, data type, and (optionally)
other information about the column.
The sum of the lengths of all columns for the table cannot exceed the maximum
row length, which is the block size minus the header. For additional restrictions on
the number of columns allowed, see Limits on page L-6 and Data Types on
page D-1.
column-name
is an SQL identifier that is the name of a column. Each column name must be
unique within the table and cannot be an SQL reserved word. You cannot use
SYSKEY as a column name except when the table has a user-defined primary key.
data-type
specifies a data type for the column and (optionally, if the data type allows) an
alternate character set or collation for the column. For information, see Data Types
on page D-1.
A specific host language might not support all SQL data types. For more
information about host language type compatibility, see the SQL/MP programming
manual for your host language.