In DB2 Display a table's definition

2020-05-22 10:42发布

Hello everybody I am learning DB2 and would like to know how to see a table's characteristics after I create one.

Similar to the EXPLAIN TABLE command in MySQL.

Thank you.

标签: db2
11条回答
▲ chillily
2楼-- · 2020-05-22 11:14

you can use the below command to see the complete characteristics of DB

db2look -d <DB NAme>-u walid -e -o

you can use the below command to see the complete characteristics of Schema

 db2look -d <DB NAme> -u walid -z <Schema Name> -e -o

you can use the below command to see the complete characteristics of table

db2look -d <DB NAme> -u walid -z <Schema Name> -t <Table Name>-e -o

you can also visit the below link for more details. https://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fr0002051.htm

查看更多
The star\"
3楼-- · 2020-05-22 11:15

Right-click the table in DB2 Control Center and chose Generate DDL... That will give you everything you need and more.

查看更多
SAY GOODBYE
4楼-- · 2020-05-22 11:15

I just came across this query to describe a table in winsql

select NAME,TBNAME,COLTYPE,LENGTH,REMARKS,SCALE from sysibm.syscolumns
where tbcreator = 'Schema_name' and tbname='Table_name' ;
查看更多
Emotional °昔
5楼-- · 2020-05-22 11:16

All that metadata is held in the DB2 catalog tables in the SYSIBM 'schema'. It varies for the DB2/z mainframe product and the DB2/LUW distributed product but they're coming closer and closer with each release.

IBM conveniently place all their manuals up on the publib site for the world to access. My area of expertise, DB2/z, has the pages you want here.

There are a number of tables there that you'll need to reference:

SYSTABLES        for table information.
SYSINDEXES    \
SYSINDEXPART   + for index information.
SYSKEYS       /
SYSCOLUMNS       for column information.

The list of all information centers is here which should point you to the DB2/LUW version if that's your area of interest.

查看更多
Evening l夕情丶
6楼-- · 2020-05-22 11:22

Describe table syntax

describe table schemaName.TableName
查看更多
登录 后发表回答