IBM Books

Default

Optional: Use this box to specify a default value for the column. Type the constant value, CURRENT DATE, CURRENT TIME, CURRENT TIMESTAMP, USER, or NULL in this field. The default value that you type will be used exactly as entered. For example, if you put double quotes around the value you type in, the double quotes will be part of the default value. If you do not specify a specific default value, the default value depends on the data type of the column as shown in the following table.

Table 3. Default Values (when no value specified)
Data Type Default Value
Numeric 0
Fixed-length character string Blanks
Varying-length character string A string of length 0
Fixed-length graphic string Double-byte blanks
Varying-length graphic string A string of length 0
Date For existing rows, a date corresponding to January 1, 0001. For added rows, the current date.
Time For existing rows, a time corresponding to 0 hours, 0 minutes, and 0 seconds. For added rows, the current time.
Timestamp For existing rows, a date corresponding to January 1, 0001, and a time corresponding to 0 hours, 0 minutes, 0 seconds and 0 microseconds. For added rows, the current timestamp.
Binary string (BLOB) A string of length 0

You can specify the following types of default values:

Constant
Specifies the constant as the default value for the column. The specified constant must:

Datetime special register
Specifies the value of the datetime special register (CURRENT DATE, CURRENT TIME, or CURRENT TIMESTAMP) at the time of INSERT or UPDATE as the default for the column. The data type of the column must be the data type that corresponds to the special register specified.

USER
Specifies the value of the USER special register at the time of INSERT or UPDATE as the default for the column. If USER is specified, the data type of the column must be a character string with a length not less than the length attribute of USER.

NULL
Specifies NULL as the default for the column. If the Nullable check box is not selected, NULL can be specified as the default but any attempt to set the column to the default value will result in an error.

Cast function
This form of a default value can be used only with columns defined as a distinct type, BLOB, or DATETIME data type.

[ Top of Page | Table of Contents | Glossary | Index ]

[ DB2 List of Books | Search the DB2 Books ]