Specifying a column's data type and default options
These steps are part of the larger task of adding a column.
When
you complete the steps for specifying the column's data type
and default options, return to
Adding a column.

To specify a column's data type and default options:
- On the Built-in Type page,
use the Data
type box to specify the data type of the column.
-
Optional: If you specified a data type of CHAR, VARCHAR, GRAPHIC, or VARGRAPHIC,
use the Length
field to specify the length (byte count) of the column. The default length
is 1 character.
-
Optional: If you specified a data type of DECIMAL, use the Precision
and Scale fields to specify the precision (total number of digits)
for the column and the scale (number of digits to the right of the decimal)
for the column. The default precision is 5 and the default scale is 0.
-
Optional: If you specified a data type of CHAR, VARCHAR, or LONG VARCHAR,
use the Data sub-type box to specify a subtype for this column:
- SBCS
- Column holds single-byte data.
- MIXED
- Column holds mixed data. MIXED can
be specified only if the DB2 installation allows mixed data.
- BIT
- Column holds BIT data.
- If you do not want the column to contain null values, clear the
Nullable check box. The default is nullable.
If you're adding this column when you are altering a table and you clear
this check box to make this column non-nullable, you must also specify
a non-nullable default for this column in the next step.
-
Optional: To specify a default value be assigned to the column when
no value is specified on an INSERT or LOAD, select the Default check
box and specify one of the following choices. The available choices shown
in the box depend on the the column data type that you selected.
- constant value
- If you select constant value, you can type a value
in the
Constant value
field.
The value of the constant must be a
valid value for that column data type.
If you do not type a value in the Constant value field, the
default value
depends on the data type
of the column.
- USER
- The column's default value is the execution-time value
of the USER special register. This choice is available only for
a character string column with a length attribute of at least 8 bytes.
If you're adding this column when you are altering a table, the value
for existing
rows is that of the USER special register at the time that the table
is altered.
- CURRENT SQLID
- The column's default value is the SQL
authorization ID (SQLID) of the process. The SQLID
is the DB2 subsystem user identifier for the current connection.
This value can be
specified only for a character string column with a length
attribute of at least 8 bytes.
If you're adding this column when you are altering a table,
the value for existing
rows is that of the SQLID at the time that the table
is altered.
- NULL
- The column's default value is the null value.
NULL is available only
if the Nullable check box is selected.
-
If you do not want to define a field procedure or comment for this column,
click Apply to add the new column. Otherwise,
return to the main task.