Neoview SQL Reference Manual (R2.4 SP2)
identity-column-specification
indicates that a particular column is a sequence-generating IDENTITY column. Neoview
SQL will generate unique values for this column by default. See “Generating Values For an
IDENTITY Column” (page 87).
• GENERATED BY DEFAULT AS IDENTITY
creates an IDENTITY column, either system-generated or user-specified. DEFAULT
specification in the place of a value is allowed. The internal sequence generator is created
when an IDENTITY column is specified.
• GENERATED ALWAYS AS IDENTITY
creates an IDENTITY column. A user-specified value is NOT allowed. DEFAULT
specification in the place of a value is allowed. The internal sequence generator is created
when an IDENTITY column is specified.
START WITH signed-numeric-literal
start value of the cycle range for the IDENTITY column. Default is 0 (zero).
INCREMENT BY signed-numeric-literal
increments the current value to obtain the next value. Default is 1 (one). The INCREMENT
BY value cannot be greater than the maximum value of the data type of the IDENTITY
column.
MAXVALUE signed-numeric-literal | NO MAXVALUE
minimum non-negative value of the data type of the IDENTITY column starting the cycle
range. The default is 0 (zero). Cannot be greater than the maximum value of the data type
of the IDENTITY column. Must be greater than the INCREMENT BY value. If NO
MAXVALUE is specified, maximum value is the maximum value of the data type of the
IDENTITY column.
MINVALUE signed-numeric-literal | NO MINVALUE
Positive value (not 0 (zero) or less than 0 (zero). If NO MINVALUE is specified, minimum
value is the minimum value of the data type of the IDENTITY column. If the data type
is LARGEINT, the minimum default value is zero, not -9223372036854775808.
NO CYCLE
means that when the MAXVALUE maximum is reached for the IDENTITY column, an
error is raised that says the maximum has been exceeded. Values will not be restarted.
If an artificially low cycle range was created by setting the MAXVALUE value lower than
the natural maximum allowed for the data type, you can use the ALTER TABLE ALTER
COLUMN SET MAXVALUE option to raise the maximum value, including up to the
natural maximum allowed for the data type. This allows more available values in the
cycle range for the internal sequence generator. Inserts will be successful until the new
maxvalue is reached. For more information, see the “ALTER TABLE Statement” (page 44).
CONSTRAINT constraint-name
specifies a name for the column or table constraint. constraint-name must have the same
schema as table and must be unique among constraint names in its schema. If you omit the
schema portions of the name you specify in constraint-name, Neoview SQL expands the
constraint name by using the schema for table. See “Database Object Names” (page 230).
NOT NULL
is a column constraint that specifies that the column cannot contain nulls. If you omit NOT
NULL, nulls are allowed in the column. If you specify both NOT NULL and NO DEFAULT,
each row inserted in the table must include a value for the column. See “Null” (page 270).
REFERENCES ref-spec NOT ENFORCED
specifies a REFERENCES column constraint. The maximum combined length of the columns
for a REFERENCES constraint is 2048 bytes.
76 SQL Statements