How to view the table structure in DB2 database
相关问题
- What is the best way to handle BOOLEAN values in D
- SQL1032N No start database manager command was iss
- COBOL DB2 program
- SQL LIKE Column Value Plus Wildcard DB2
- copying a very large table from one DB2 to another
相关文章
- Escape percentage sign DB2 SQL
- DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703 [clo
- Extra rows being received when matching pairs in S
- How to check DB2 SYSADM or SYSCTRL authorization f
- Which is the Best database for Rails application?
- How do I get connection pooling working on a PHP-C
- Why can't my As400 select from a newly created
- Where do I download JDBC drivers for DB2 that are
Use the below to check the table description for a single table
join the below tables to check the table description for a multiple tables, join with the table id syscat.tables and syscat.columns
You can also check the details of indexes on the table using the below command describe indexes for table . show detail
Also the following command works:
Where the select statement can be replaced with any other select statement, which is quite useful for complex inserts with select for example.
The OP doesn't mention if this is DB2/400 being discussed, but I found that the only way I could get the table structure including the column name descriptions was to use DSPFFD.
DSPFFD FILE(TBNAME) OUTPUT(*OUTFILE) OUTFILE(SOMELIB/TBDESC)
This puts the description of TBNAME in a table called TBDESC in the SOMELIB library. You can then query that with:
select * from SOMELIB/TBDESC
FOR TABLE DESCRIPTION IN IBM DB2 10.7 VERSION I TRIED THIS AND IT WORKED FINE
Open
db2
command window, connect to db2 with following command.Once you connected successfully, issue the following command to view the table structure.
The above command will display db2 table structure in tabular format.
Note: Tested on DB2 Client 9.7.11
php example for iSeries (as400) db2, yes this worked!
also if you just want to list all tables with their descriptions