How to view DB2 Table structure

2020-02-17 05:04发布

How to view the table structure in DB2 database

标签: db2
19条回答
孤傲高冷的网名
2楼-- · 2020-02-17 05:17

I am running DB2/LINUXX8664 10.5.3 and describe select * from schema_name.table_name works for me.

However, describe table schema_name.table_name fails with this error:

SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000

查看更多
Viruses.
3楼-- · 2020-02-17 05:18

I got the answer from the sysibm.syscolumns

Select distinct(name), ColType, Length from Sysibm.syscolumns where tbname = 'employee';
查看更多
Animai°情兽
4楼-- · 2020-02-17 05:18

Follow this simple steps:

  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.
查看更多
狗以群分
5楼-- · 2020-02-17 05:19

You can Get the table meta data using this query

SELECT * FROM SYSIBM.COLUMNS WHERE TABLE_NAME = 'ASTPCLTEXT';
查看更多
冷血范
6楼-- · 2020-02-17 05:22

1.use db2 describe table

  db2 describe table tabschema.tabname

2.use db2 describe output

  db2 "describe select * from tabschema.tabname"

3.use db2look utility

  db2look -d dbname -e -t tabname

4.find rows in db2 syscat

  db2 "Select * from syscat.columns wher tabname='' and tabschema =''"
查看更多
欢心
7楼-- · 2020-02-17 05:23

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

查看更多
登录 后发表回答