Ans:
SELECT A.CREATOR, A.TBNAME, A.RELNAME, B.COLNAME, B.COLSEQ,
A.REFTBCREATOR, A.REFTBNAME
FROM SYSIBM.SYSRELS A, SYSIBM.SYSFOREIGNKEYS B
WHERE A.CREATOR = 'SOURCE'
AND B.CREATOR = 'SOURCE'
AND A.TBNAME = 'TABLE_NAME'
-- AND B.TBNAME = 'PROJ'
AND A.RELNAME = B.RELNAME
ORDER BY A.RELNAME, B.COLSEQ
2. How to find index in a Table in DB2?
Ans:
SELECT DISTINCT
A.TBNAME,
B.COLNAME,
A.INDEXSPACE,
A.DBNAME,
A.CLUSTERING,
A.CLUSTERED
FROM SYSIBM.SYSINDEXES A, SYSIBM.SYSKEYS B
WHERE
A.CREATOR = 'SOURCE'
AND TBNAME = 'TABLE_NAME'
AND A.NAME =B.IXNAME
Best Regards,
Moorthy. G
No comments:
Post a Comment