SYSCOLUMNS

The SYSCOLUMNS view contains one row for every column of each table and view in the SQL schema (including the columns of the SQL catalog).

The following table describes the columns in the SYSCOLUMNS view:

Table 1. SYSCOLUMNS view
Column name System Column Name Data Type Description
COLUMN_NAME NAME VARCHAR(128) Name of the column. This will be the SQL column name if one exists; otherwise, it will be the system column name.
TABLE_NAME TBNAME VARCHAR(128) Name of the table or view that contains the column. This will be the SQL table or view name if one exists; otherwise, it will be the system table or view name.
TABLE_OWNER TBCREATOR VARCHAR(128) The owner of the table or view.
ORDINAL_POSITION COLNO INTEGER Numeric place of the column in the table or view, ordered from left to right.
DATA_TYPE COLTYPE VARCHAR(8) Type of column:
BIGINT
Big number
INTEGER
Large number
SMALLINT
Small number
DECIMAL
Packed decimal
NUMERIC
Zoned decimal
FLOAT
Floating point; FLOAT, REAL, or DOUBLE PRECISION
DECFLOAT
Decimal floating-point
CHAR
Fixed-length character string
VARCHAR
Varying-length character string
CLOB
Character large object string
GRAPHIC
Fixed-length graphic string
VARG
Varying-length graphic string
DBCLOB
Double-byte character large object string
BINARY
Fixed-length binary string
VARBIN
Varying-length binary string
BLOB
Binary large object string
DATE
Date
TIME
Time
TIMESTMP
Timestamp
DATALINK
Datalink
ROWID
Row ID
XML
XML
DISTINCT
Distinct type
LENGTH LENGTH INTEGER The length attribute of the column; or, in the case of a decimal, numeric, or nonzero precision binary column, its precision:
8 bytes
BIGINT
4 bytes
INTEGER
2 bytes
SMALLINT
Precision of number
DECIMAL
Precision of number
NUMERIC
8 bytes
FLOAT, FLOAT(n) where n = 25 to 53, or DOUBLE PRECISION
4 bytes
FLOAT(n) where n = 1 to 24, or REAL
8 bytes
DECFLOAT(16)
16 bytes
DECFLOAT(34)
Length of string
CHAR
Maximum length of string
VARCHAR or CLOB
Length of graphic string
GRAPHIC
Maximum length of graphic string
VARGRAPHIC or DBCLOB
Length of string
BINARY
Maximum length of binary string
VARBIN or BLOB
4 bytes
DATE
3 bytes
TIME
Start of changeThe integral part of ((p+1)/2)+7 where p is the precision of the timestampEnd of change
TIMESTAMP
Maximum length of datalink URL and comment
DATALINK
40 bytes
ROWID
2147483647 bytes
XML
Same value as the source type
DISTINCT
NUMERIC_SCALE SCALE
INTEGER
Nullable
Scale of numeric data.

Contains the null value if the column is not decimal, numeric, or binary.

IS_NULLABLE NULLS CHAR(1) If the column can contain null values:
N
No
Y
Yes
IS_UPDATABLE UPDATES CHAR(1) If the column can be updated:
N
No
Y
Yes
LONG_COMMENT REMARKS VARGRAPHIC(2000) CCSID 1200
Nullable
A character string supplied with the COMMENT statement.

Contains the null value if there is no long comment.

HAS_DEFAULT DEFAULT CHAR(1) If the column has a default value (DEFAULT clause or null capable):
N
No
Y
Yes
A
The column has a ROWID data type and the GENERATED ALWAYS attribute.
D
The column has a ROWID data type and the GENERATED BY DEFAULT attribute.
E
The column is defined with the FOR EACH ROW ON UPDATE and the GENERATED ALWAYS attribute.
F
The column is defined with the FOR EACH ROW ON UPDATE and the GENERATED BY DEFAULT attribute.
I
The column is defined with the AS IDENTITY and GENERATED ALWAYS attributes.
J
The column is defined with the AS IDENTITY and GENERATED BY DEFAULT attributes.
If the column is for a view, N is returned.
COLUMN_HEADING LABEL VARGRAPHIC(60) CCSID 1200
Nullable
A character string supplied with the LABEL statement (column headings)

Contains the null value if there is no column heading.

STORAGE STORAGE INTEGER The storage requirements for the column:
8 bytes
BIGINT
4 bytes
INTEGER
2 bytes
SMALLINT
(Precision/2) + 1
DECIMAL
Precision of number
NUMERIC
8 bytes
FLOAT, FLOAT(n) where n = 25 to 53, or DOUBLE PRECISION
4 bytes
FLOAT(n) where n = 1 to 24, or REAL
8 bytes
DECFLOAT(16)
16 bytes
DECFLOAT(34)
Length of string
CHAR or BINARY
Maximum length of string + 2
VARCHAR or VARBIN
Maximum length of string + 29
CLOB or BLOB
Length of string * 2
GRAPHIC
Maximum length of string * 2 + 2
VARGRAPHIC
Maximum length of string * 2 + 29
DBCLOB
4 bytes
DATE
3 bytes
TIME
Start of changeThe integral part of ((p+1)/2)+7 where p is the precision of the timestampEnd of change
TIMESTAMP
Maximum length of datalink URL and comment + 24
DATALINK
42 bytes
ROWID
2147483647 bytes + 29
XML
Same value as the source type
DISTINCT
Note: This column supplies the storage requirements for all data types.
NUMERIC_PRECISION PRECISION INTEGER
Nullable
The precision of all numeric columns.
Note: This column supplies the precision of all numeric data types, including decimal floating-point and single-and double-precision floating point. The NUMERIC_PRECISION_RADIX column indicates if the value in this column is in binary or decimal digits.

Contains the null value if the column is not numeric.

CCSID CCSID INTEGER
Nullable
The CCSID value for CHAR, VARCHAR, CLOB, DATE, TIME, TIMESTAMP, GRAPHIC, VARGRAPHIC, DBCLOB, XML, and DATALINK columns.

Contains 65535 if the column is a BINARY, VARBIN, BLOB, or ROWID.

Contains the null value if the column is a numeric data type.

TABLE_SCHEMA DBNAME VARCHAR(128) The name of the SQL schema containing the table or view.
COLUMN_DEFAULT DFTVALUE VARGRAPHIC(2000) CCSID 1200
Nullable
The default value of a column, if one exists. If the default value of the column cannot be represented without truncation, then the value of the column is the string 'TRUNCATED'. The default value is stored in character form. The following special values also exist:
CURRENT_DATE
The default value is the current date.
CURRENT_TIME
The default value is the current time.
CURRENT_TIMESTAMP
The default value is the current timestamp.
NULL
The default value is the null value and DEFAULT NULL was explicitly specified.
USER
The default value is the current job user.

Contains the null value if:

  • The column has no default value. For example, if the column has an IDENTITY attribute, is a row ID, or is a row change timestamp column; or
  • A DEFAULT value was not explicitly specified.
CHARACTER_MAXIMUM_LENGTH CHARLEN INTEGER
Nullable
Maximum length of the string for binary, character, and graphic string and XML data types.

Contains the null value if the column is not a string.

CHARACTER_OCTET_LENGTH CHARBYTE INTEGER
Nullable
Number of bytes for binary, character, and graphic string and XML data types.

Contains the null value if the column is not a string.

NUMERIC_PRECISION_RADIX RADIX INTEGER
Nullable
Indicates if the precision specified in column NUMERIC_PRECISION is specified as a number of binary or decimal digits
2
Binary; floating-point precision is specified in binary digits.
10
Decimal; all other numeric types are specified in decimal digits.

Contains the null value if the column is not numeric.

DATETIME_PRECISION DATPRC INTEGER
Nullable
The fractional part of a date, time, or timestamp.
0
For DATE and TIME data types
Start of change0-12End of change
Start of changeFor TIMESTAMP data types (number of fractional seconds).End of change

Contains the null value if the column is not a date, time, or timestamp.

COLUMN_TEXT LABELTEXT VARGRAPHIC(50) CCSID 1200
Nullable
A character string supplied with the LABEL statement (column text)

Contains the null value if the column has no column text.

SYSTEM_COLUMN_NAME SYS_CNAME CHAR(10) The system name of the column
SYSTEM_TABLE_NAME SYS_TNAME CHAR(10) The system name of the table or view
SYSTEM_TABLE_SCHEMA SYS_DNAME CHAR(10) The system name of the schema
USER_DEFINED_TYPE_SCHEMA TYPESCHEMA VARCHAR(128)
Nullable
The name of the schema if this is a distinct type.

Contains the null value if the column is not a distinct type.

USER_DEFINED_TYPE_NAME TYPENAME VARCHAR(128)
Nullable
The name of the distinct type.

Contains the null value if the column is not a distinct type.

IS_IDENTITY IDENTITY VARCHAR(3) This column identifies whether the column is an identity column.
NO
The column is not an identity column.
YES
The column is an identity column.
IDENTITY_GENERATION GENERATED VARCHAR(10)
Nullable
This column identifies whether the column is GENERATED ALWAYS or GENERATED BY DEFAULT.
ALWAYS
The column value is always generated.
BY DEFAULT
The column value is generated by default.

Contains the null value if the column is not a ROWID, IDENTITY, or row change timestamp column.

IDENTITY_START START DECIMAL(31,0)
Nullable
Starting value of the identity column.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_INCREMENT INCREMENT DECIMAL(31,0)
Nullable
Increment value of the identity column.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_MINIMUM MINVALUE DECIMAL(31,0)
Nullable
Minimum value of the identity column.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_MAXIMUM MAXVALUE DECIMAL(31,0)
Nullable
Maximum value of the identity column.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_CYCLE CYCLE VARCHAR(3)
Nullable
This column identifies whether the identity column values will continue to be generated after the minimum or maximum value has been reached.
NO
Values will not continue to be generated.
YES
Values will continue to be generated.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_CACHE CACHE INTEGER
Nullable
Specifies the number of identity values that may be preallocated for faster access. Zero indicates that the values will not be preallocated.

Contains the null value if the column is not an IDENTITY column.

IDENTITY_ORDER ORDER VARCHAR(3)
Nullable
Specifies whether the identity values must be generated in order of the request.
NO
Values do not need to be generated in order of the request.
YES
Values must be generated in order of the request.

Contains the null value if the column is not an IDENTITY column.

COLUMN_EXPRESSION EXPRESSION DBCLOB(2097152)
CCSID 1200
Nullable
If the column is an expression, contains the expression.

Contains the null value if the column is not an expression.

HIDDEN HIDDEN CHAR(1) Specifies whether the column is included in an implicit column list.
P
Partially hidden.
N
Not hidden.
HAS_FLDPROC FLDPROC CHAR(1) Specifies whether the column has a field procedure.
N
Column does not have a field procedure.
Y
Column has a field procedure.