Check if is column nullable in Db2 database

Query below check nullability attribute for the column.

Query

select tabschema as schema_name, 
    tabname as table_name,
    colname as column_name, 
    case nulls 
        when 'N' then 'not nullable'
        when 'Y' then 'is nullable'
    end as nullable 
from syscat.columns 
where tabschema not like 'SYS%' 
order by tabschema, tabname,colname; 

Columns

  • schema_name - name of schema
  • table_name - name of table
  • column_name - column name
  • nullable - nullability attribute for the column:
    • is nullable - is nullable
    • not nullable - is not nullable

Rows

  • One row represents one column in the database
  • Scope of rows: all columns in the database
  • Ordered by schema name, table name, column name

Sample results

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.