Is there any way I get all column names and assoicated table names which has identity column set as generated always?
For I dentity columns I can simply use syscat.columns but how to fitler identity columns which has generated always vallue?
select identity, substr(tabname,1,30), substr(colname, 1, 30) from syscat.columns where tabschema='MYSCHEMA'"
From the above select list I wanted to filter only columns which uses generated values...
The online documentation for SYSCAT.COLUMNS. The two columns you're interested in are IDENTITY and GENERATED.
Your query will probably be something like:
SELECT TABNAME,COLNAME FROM SYSCAT.COLUMNS WHERE
IDENTITY='Y' AND GENERATED = 'A' AND TABSCHEMA='MYSCHEMA'