DB2获取当前用户表、字段、索引等详细信息
程序员文章站
2022-06-17 19:29:30
获取所有表、字段、索引等详细信息select d.name tbname,coalesce(d.remarks, ') tbdesc,a.name columnname,a.coltype colu...
获取所有表、字段、索引等详细信息
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'