Previous Topic: Column DefinitionNext Topic: Column Constraint Definition


Description

column-name

The name of a column of the table. Do not use the same name for more than one column in this table.

If you specify SQLMODE=ANSI or SQLMODE=FIPS in the Preprocessor options, the column name can be 1 to 18 characters in length.

If you specify SQLMODE=DATACOM for extended mode in the Preprocessor options, the column name can be 1 to 32 characters in length.

The number of columns you can define for a single table is limited only by the maximum size of the physical record. The sum of the byte counts of the columns must not be less than 1 or greater than 32720.

If you use the UNIQUE (column-list) constraint in a table constraint definition (see Table Constraint Definition), you must separate the last column definition from the UNIQUE (column-list) constraint with a comma.

If you specify a ref-col-name in the column constraint definition (see Column Constraint Definition), the data type, length, and scale of the column-name specified here in the column definition must be identical to those of the ref-col-name.

The first column you name in the CREATE TABLE statement becomes the CA Datacom/DB Master and Native Key for the table except when a primary key has been defined. Datadictionary automatically generates this KEY entity-occurrence, which has the same name as the column.

Note: The DUPE-MASTER-KEY and CHNG-MASTER-KEY attributes of the TABLE entity-occurrence are set to Y, indicating that the value of the Master Key can be duplicated and/or changed. The 5-character CA Datacom/DB name of the key is SQnnn, where nnn is a sequential number unique to each database.

datatype

See Data Types.

Note: If NOT NULL WITH DEFAULT is specified as a constraint with DATE, TIME, or TIMESTAMP, the default value is the current date, current time, or current timestamp.

DEFAULT

Used to specify a default. If DEFAULT is specified, you cannot use a column constraint of WITH DEFAULT.

literal

Specifies a literal as the default. The literal you specify must be consistent with the data type of the column. A user-supplied DEFAULT literal can be up to 20 bytes long, or the length of the column involved, whichever is shorter. A default value may be specified for a character column where the column is greater than 20 bytes long, but the default literal itself is limited to 20 bytes, with the remaining bytes padded with blanks by the system.

NULL

Specifies NULL as the default. If NULL is specified, you cannot use a column constraint of NOT NULL.

column constraint

See the column constraint definition in the following.

USER

Specifies the current authorization ID as the default.

SYSTEM USER

This CA Datacom/DB extension specifies the accessor ID of the currently signed-on user as the default.