List table default values in Db2 database

Query below lists table check constraints.

Query

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

Columns

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

Rows

  • 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.

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.