SQLCOLUMNS

The SQLCOLUMNS view contains one row for every column in a table, view, or alias.

The following table describes the columns in the view:

Table 1. SQLCOLUMNS view
Column Name Data Type Description
TABLE_CAT VARCHAR(128) Relational database name.
TABLE_SCHEM VARCHAR(128) Name of the SQL schema that contains the table.
TABLE_NAME VARCHAR(128) Table name.
COLUMN_NAME VARCHAR(128) Column name.
DATA_TYPE SMALLINT The data type of the column:
–5
BIGINT
4
INTEGER
5
SMALLINT
3
DECIMAL
2
NUMERIC
8
DOUBLE PRECISION
7
REAL
-360
DECFLOAT
1
CHARACTER
–2
CHARACTER FOR BIT DATA or BINARY
12
VARCHAR
–3
VARCHAR FOR BIT DATA or VARBINARY
-99
CLOB
–95
GRAPHIC
–96
VARGRAPHIC
–350
DBCLOB
–8
NCHAR
–9
NVARCHAR
–10
NCLOB
-98
BLOB
91
DATE
92
TIME
93
TIMESTAMP
70
DATALINK
–100
ROWID
-370
XML
17
DISTINCT
TYPE_NAME VARCHAR(261) The name of the data type of the column:
BIGINT
BIGINT
INTeger
INTEGER
SMALLINT
SMALLINT
DECIMAL
DECIMAL
NUMERIC
NUMERIC
FLOAT
DOUBLE PRECISION
REAL
REAL
DECFLOAT
DECFLOAT
CHARacter
CHARACTER
CHARacter FOR BIT DATA
CHARACTER FOR BIT DATA
VARCHAR
VARCHAR
VARCHAR FOR BIT DATA
VARCHAR FOR BIT DATA
CLOB
CLOB
GRAPHIC
GRAPHIC
VARGRAPHIC
VARGRAPHIC
DBCLOB
DBCLOB
NCHAR
NCHAR
NVARCHAR
NVARCHAR
NCLOB
NCLOB
BINARY
BINARY
VARBINARY
VARBINARY
BLOB
BLOB
DATE
DATE
TIME
TIME
TIMESTAMP
TIMESTAMP
DATALINK
DATALINK
ROWID
ROWID
XML
XML
Qualified Type Name
DISTINCT
COLUMN_SIZE INTEGER The length of the column.
BUFFER_LENGTH INTEGER Indicates the length of the column in a buffer.
DECIMAL_DIGITS SMALLINT
Nullable
Indicates the number of digits for a numeric column.

Contains the null value if the object is not numeric or timestamp.

NUM_PREC_RADIX SMALLINT
Nullable
Indicates the radix of a numeric column.

Contains the null value if the object is not numeric.

NULLABLE SMALLINT Indicates whether the column can contain the null value.
0
The column does not allow nulls.
1
The column does allow nulls.
REMARKS VARCHAR(2000)
Nullable
A character string supplied with the COMMENT statement.

Contains the null value if there is no long comment.

COLUMN_DEF VARCHAR(2000)
Nullable
The default value of the column.

Contains the null value if there is no default value.

SQL_DATA_TYPE SMALLINT Indicates the SQL data type of the column.
–5
BIGINT
4
INTEGER
5
SMALLINT
3
DECIMAL
2
NUMERIC
8
DOUBLE PRECISION
7
REAL
-360
DECFLOAT
1
CHARACTER
–2
CHARACTER FOR BIT DATA or BINARY
12
VARCHAR
–3
VARCHAR FOR BIT DATA or VARBINARY
-99
CLOB
–95
GRAPHIC
–96
VARGRAPHIC
–350
DBCLOB
–8
NCHAR
–9
NVARCHAR
–10
NCLOB
-98
BLOB
9
DATE
9
TIME
9
TIMESTAMP
70
DATALINK
–100
ROWID
-370
XML
17
DISTINCT
SQL_DATETIME_SUB SMALLINT
Nullable
The datetime subtype of the data type:
1
DATE
2
TIME
3
TIMESTAMP

Contains the null value if the column is not a datetime data type.

CHAR_OCTET_LENGTH INTEGER
Nullable
Indicates the length in bytes of the column.

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

ORDINAL_POSITION INTEGER Indicates the ordinal position of the column in the table.
IS_NULLABLE VARCHAR(3) Indicates whether the column can contain the null value.
NO
The column is not nullable.
YES
The column is nullable.
JDBC_DATA_TYPE SMALLINT Indicates the JDBC data type of the column.
–5
BIGINT
4
INTEGER
5
SMALLINT
3
DECIMAL
2
NUMERIC
8
DOUBLE PRECISION
7
REAL
1111
DECFLOAT
1
CHARACTER or GRAPHIC
Start of change-15End of change
Start of changeNCHAREnd of change
–2
CHARACTER FOR BIT DATA or BINARY
12
VARCHAR or VARGRAPHIC
Start of change-9End of change
Start of changeNVARCHAREnd of change
–3
VARCHAR FOR BIT DATA or VARBINARY
2005
CLOB or DBCLOB
Start of change2011End of change
Start of changeNCLOBEnd of change
2004
BLOB
91
DATE
92
TIME
93
TIMESTAMP
70
DATALINK
Start of change-8End of change
ROWID
2009
XML
2001
DISTINCT
SCOPE_CATALOG VARCHAR(128)
Nullable
Reserved. Contains the null value.
SCOPE_SCHEMA VARCHAR(128)
Nullable
Reserved. Contains the null value.
SCOPE_TABLE VARCHAR(128)
Nullable
Reserved. Contains the null value.
SOURCE_DATA_TYPE SMALLINT
Nullable
The source data type if the data type of the column is a distinct type. For values see JDBC_DATA_TYPE.

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

DBNAME VARCHAR(8)
Nullable
Reserved. Contains the null value.
PSEUDO_COLUMN SMALLINT Indicates whether this is a ROWID, identity, or row change timestamp column.
1
The column is not a ROWID, identity, or row change timestamp column.
2
The column is a ROWID, identity, or row change timestamp column.
COLUMN_TEXT VARCHAR(50)
Nullable
The text of the column.

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

SYSTEM_COLUMN_NAME CHAR(10) The system name of the column.
I_DATA_TYPE SMALLINT Indicates the IBM® i CLI data type of the column.
19
BIGINT
4
INTEGER
5
SMALLINT
3
DECIMAL
2
NUMERIC
8
DOUBLE PRECISION
7
REAL
-360
DECFLOAT
1
CHARACTER
–2
CHARACTER FOR BIT DATA or BINARY
12
VARCHAR
–3
VARCHAR FOR BIT DATA or VARBINARY
14
CLOB
95
GRAPHIC or NCHAR
96
VARGRAPHIC or NVARCHAR
15
DBCLOB or NCLOB
13
BLOB
91
DATE
92
TIME
93
TIMESTAMP
16
DATALINK
Start of change1111End of change
ROWID
-370
XML
2001
DISTINCT
Start of changeHIDDENEnd of change Start of changeCHAR(1)End of change Start of changeSpecifies whether the column is included in an implicit column list.
P
Partially hidden.
N
Not hidden.
End of change
HAS_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.
SOURCE_TYPE_NAME VARCHAR(128)
Nullable
If the column data type is a user-defined type, the built-in data type name of its source type.

Contains the null value if the column data type is not a user-defined type.

SOURCE_SQL_DATA_TYPE SMALLINT
Nullable
If the column data type is a user-defined type, the built-in SQL_DATA_TYPE of its source type. For values see SQL_DATA_TYPE.

Contains the null value if the column data type is not a user-defined type.

SOURCE_JDBC_DATA_TYPE SMALLINT
Nullable
If the column data type is a user-defined type, the built-in JDBC_DATA_TYPE of its source type. For values see JDBC_DATA_TYPE.

Contains the null value if the column data type is not a user-defined type.