tags:

views:

50

answers:

4

How to view the table structure in DB2 database

Please help me

Thanks! in Advance

Regards Ambut Bhath

A: 

to get all tables: (You may want to restrict schema to your schema)

select * from syscat.tables

to get all columns: (where tabname = your_tabname)

select * from syscat.columns
Peter Miehle
I couldn't get the result for the above given.
Ambut bhath
A: 

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

Ian Bjorhovde
Thanks for your answer. But i couldn't get the result
Ambut bhath
What platform are you using? Based on your comments, I suspect it may be zOS.
Ian Bjorhovde
A: 

I got the answer from the sysibm.syscolumns

ie.,

Select distinct(name), ColType, Length from Sysibm.syscolumns where tbname = 'employee'

Thanks!

Ambut bhath
A: 
  1. Select the Browsers window
  2. Extract(expand) it.
  3. Select and extract(expand) the table list.
  4. Select the required table and extract(expand) it.
  5. On double click the code option it opens the table structure.
Ambut bhath