2009년 9월 15일 화요일

HiRDB meta info read

★Oracleの場合
【テーブル一覧取得】
SELECT
TB.TABLE_NAME
,CM.COMMENTS
FROM
USER_TABLES TB
INNER JOIN USER_TAB_COMMENTS CM ON
TB.TABLE_NAME = CM.TABLE_NAME
ORDER BY
TB.TABLE_NAME

【カラム一覧取得】
SELECT
CL.COLUMN_NAME
,CM.COMMENTS
FROM
USER_TAB_COLUMNS CL
INNER JOIN USER_COL_COMMENTS CM ON
CL.TABLE_NAME = CM.TABLE_NAME
WHERE
CL.TABLE_NAME = ''
ORDER BY
CL.COLUMN_ID


★HiRDBの場合
【テーブル一覧取得】
SELECT
TABLE_NAME
,TABLE_COMMENT
FROM
MASTER.SQL_TABLES
WHERE
TABLE_SCHEMA = USER
ORDER BY
TABLE_NAME
WITHOUT LOCK NOWAIT

【カラム一覧取得】
SELECT
COLUMN_NAME
,COLUMN_COMMENT
FROM
MASTER.SQL_COLUMNS
WHERE
TABLE_SCHEMA = USER
AND TABLE_NAME = ''
ORDER BY
COLUMN_ID
WITHOUT LOCK NOWAIT

댓글 없음:

댓글 쓰기