Quote:
Originally Posted by prakash56
db2 "select colname from syscat.columns where PARTKEYSEQ=1 and tabname='<TABLENAME>'"
|
That is not the partition key name, it might be an index or primary key. I ran this on a table where I know the partition column name, and it does not return the partitioned column name.
PARTKEYSEQ = The column's numerical position within the table's distribution key; 0 or the null value if the column is not in the distribution key. Null for columns of subtables and hierarchy tables.
To find the partitioned column name used -
-- identify column names used in partitions
select tabschema
,tabname
,cast(datapartitionexpression as varchar(100)) part_column
from syscat.datapartitionexpression
where tabschema = 'SCHEMA_OWNER'
order by 1,2
;