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
to get all tables: (You may want to restrict schema to your schema)
to get all columns: (where tabname = your_tabname)
The easiest way as many have mentioned already is to do a DESCRIBE TABLE
However you can also get some the same + additional information from
I usually use SYSCAT.COLUMNS to find the related tables in the database where I already know the column name :)
Another good way if you want to get the DDL of a particular table or the whole database is to use the db2look
This will generate the ".out" file for you which will contain the particular table's DDL script.
This will generate the entire database's DDL as a single script file, this is usually used to replicate the database, "-e" is to indicate that one wants to export DDL suitable recreate exact same setup in a new database.
Hope this can help someone looking for such answers :)
Control Center already got the feature of that. It's just below the table list.
I am using Aquadata Studio 12.0.23, which is several versions short of the newest. So your experience may be better than mine. I found that the best way to get an overview was to use the ERD generator. It took a couple of hours, since normalization was not a concept used in the design of this database almost 30 years ago. I was able to get definitions for all of the objects in a few hours, with a file for each.
In DB2, enter on db2 command prompt.