Description of columns in a DB2 table


-- NOTE: the where clause is case sensitive and needs to be uppercase

t.table_schema as Library
,c.character_maximum_length as Length
,c.numeric_precision as Precision
,c.numeric_scale as Scale
from sysibm.tables t
join sysibm.columns c
on t.table_schema = c.table_schema
and t.table_name = c.table_name
where t.table_schema = 'MYLIB'
and t.table_name = 'MYTABLE'
order by t.table_name, c.ordinal_position

-- to get a list of all the meta tables:

select * from sysibm.tables
where table_schema = 'SYSIBM'


How can we know the description of every column in a table(DB2) through SQL?

My data base is DB2.

Perl DBI: store the ddl of a column in a variable

Most database have tables about table info, or meta data. Looks like you are using DB2, so here is an example Description of columns in a DB2 table

You could also copy part of a table to a temporary table.