DB2 SQL Script Memo

视图

筛选包含某表的视图列表

1
2
3
SELECT t.viewschema, t.viewname
FROM syscat.viewdep t
WHERE t.bname = UPPER ('#table') AND t.viewschema = '#schema';

筛选系统字段表

1
2
3
4
5
6
7
8
  SELECT *
FROM syscat.columns c
WHERE EXISTS
(SELECT 1
FROM syscat.tables t
WHERE owner = '#schema' AND t.TABNAME = c.TABNAME)
AND UPPER (c.COLNAME) LIKE '%#column%'
ORDER BY c.TABNAME;