Find table that DON'T have a column with specific name in Db2 database

Databases often have standard columns. Examples of such standard columns can be id, modified_date, created_by or row_version.

Query below finds all tables that do not have a 'MODIFIEDDATE' column.


select t.tabschema as schema_name,
       t.tabname as table_name
from syscat.tables t
left outer join 
    (select tabschema,
    from syscat.columns 
    where  colname ='MODIFIEDDATE'
    )c on c.tabschema = t.tabschema and c.tabname = t.tabname
where t.type='T'
and c.tabname is  null
order by schema_name,


  • schema_name - name of schema of found table
  • table_name - name of found table


  • One row represents a table
  • Scope of rows: all found tables
  • Ordered by schema name

Sample results

These tables do not have a 'MODIFIEDDATE' column.

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