Query below lists all computed columns in IBM Db2 database
Query
select tabschema as schema_name,
tabname as table_name,
colno as col_no,
colname as column_name,
typename as data_type,
text as generation_expression
from syscat.columns
where tabschema not like 'SYS%'
and generated = 'A'
order by schema_name,
table_name,
col_no;
Columns
- schema_name - schema name containing table
- table_name - table name
- col_no - column position in table
- column_name - name of the column
- data_type - data type of column
- generation_expression - computing formula
Rows
- One row represents one generated column
- Scope of rows: represents all computed columns from all schemas
- Ordered by schema name, table name and column position