List table default values in Db2 database

Query below lists table check constraints.


Select tabschema concat '.' concat tabname as table,
    colname as column_name,
    default as default_value
from syscat.columns
where tabschema not like 'SYS%'
    and default is not null
order by tabschema,
    tabname, colname


  • table - schema and table name
  • column_name - name of the column
  • default - SQL expression that defines this default value


  • One row represents one column
  • Scope of rows: query returns all columns with default values
  • Ordered by table schema and name, column name

Sample results

List of table default values in Db2 database.

There are no comments. Click here to write the first comment.