Page 1 of 1

Describe a Table

PostPosted: Wed Jul 22, 2009 5:12 pm
by eprasad629
Hi,

Good day!!!

I would like to know the query which will describe a table's structure.

I have done this in SQL Plus through DESC <table-name> command. However, this doesn't works out in DB2-SQL. Though RC-Manager could describe the structure of a table; I want to attain this through a query.

Could you please suggest me a solution?

Many thanks in advance.

Re: Describe a Table

PostPosted: Wed Jul 22, 2009 5:33 pm
by swd
For DB2 you can find a tables structure eith by looking at the DDL or the DCLGEN or you can query the DB2 catalog with something like this

SELECT *
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = 'TABLENAME'
AND TBCREATOR = 'CREATORNAME'
ORDER BY COLNO
;

This should give you something similar to the Oracle DESC output.