How can I find if a specific column is part of a key?
book
Article ID: 98225
calendar_today
Updated On:
Products
DatacomDATACOM - AD
Issue/Introduction
We need to identify whether a field is part of a key / index from a table. I like to get that information by running an SQL query. How can I do that?
Environment
z/OS CA Datacom 15.1
Resolution
You can run this SQL query:
SELECT RECORD_NAME , AUTHID , AGR_SQLNAME , DATACOM_NAME, DATACOM_ID FROM SYSADM.KEY WHERE ENABLE = 'Y' AND STATUS = 'P' AND KEY_TYPE = 'I' AND RECORD_NAME = 'your record name' AND ( KY1FLDNM = 'your field' OR KY2FLDNM = 'your field' OR KY3FLDNM = 'your field' OR KY4FLDNM = 'your field')