NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
C-146
CREATE TABLE Statement
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. See Limits
on page L-5 and Data
Types on page D-1 for additional restrictions on the number of columns allowed.
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. See Data Types on page D-1 for
details.
A specific host language might not support all SQL data types. For information
about host language type compatibility, see the NonStop SQL/MP programming
manual for your host language.
DEFAULT default | NO DEFAULT
specifies a default value for the column or specifies that the column does not have a
default value. default can be a literal of one of the special values CURRENT,
SYSTEM, or NULL. See DEFAULT Clause on page D-24 for details.
You must specify the DEFAULT clause if you specify the NOT NULL clause
because the default is DEFAULT NULL.
NOT NULL
specifies that the column cannot contain any null values. SQL allows null values in
a column unless you specify NOT NULL.
If you specify NOT NULL and NO DEFAULT, you must supply a value for the
column in each row inserted. You cannot specify NOT NULL if you also specify
DEFAULT NULL, either explicitly or by default.
HEADING string | NO HEADING
specifies a default heading for the column or specifies that the column has no default
heading.