好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

DB2获取当前用户表、字段、索引等详细信息

 获取所有表、字段、索引等详细信息

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

SELECT

 

d. name tbName,

COALESCE (d.remarks, '' ) tbDesc,

a. name columnName,

a.coltype columnType ,

decode(a.nulls, 'Y' , '1' , '0' ) notNull,

decode(a.identity, 'Y' , '1' , '0' ) auto,

a.longlength width,

a.scale precision ,

COALESCE (a.remarks, '' ) comment,

decode(n.unique_colcount, '1' , '1' , '0' ) unique ,

decode(n.uniquerule, 'P' , '1' , '0' ) masterKey,

COALESCE (n. name , '' ) indexName

FROM

sysibm.syscolumns a

INNER JOIN sysibm.systables d on a.tbname=d. name

LEFT JOIN sysibm.sysindexes n on n.tbname=d. name and SUBSTR(colnames,2)=a. name

where

d.type= 'T' and d.tbspace= 'USERSPACE1'

查看更多关于DB2获取当前用户表、字段、索引等详细信息的详细内容...

  阅读:23次