How to view the table structure in DB2 database
So desc or describe command shows the structure of table which include name of the column, data-type of column and the nullability which means, that column can contain null values or not. All of these features of table are described at the time of Creation of table.
Tables are logical structure maintained by Database manager. In a table each vertical block called as column (Tuple) and each horizontal block called as row (Entity). The collection of data stored in the form of columns and rows is known as a table. In tables, each column has different data type.
Right-click the table in DB2 Control Center and chose Generate DDL... That will give you everything you need and more.
I got the answer from the sysibm.syscolumns
Select distinct(name), ColType, Length from Sysibm.syscolumns where tbname = 'employee';
Generally it's easiest to use DESCRIBE.
DESCRIBE TABLE MYSCHEMA.TABLE
or
DESCRIBE INDEXES FOR MYSCHEMA.TABLE SHOW DETAIL
etc.
See the documentation: DESCRIBE command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With