How to know the primary key of a table without defining the
primary key in the table?

Answer Posted / mani

Execute:

SELECT TBCREATOR, TBNAME, NAME, KEYSEQ
FROM SYSIBM.SYSCOLUMNS
WHERE TBCREATOR = 'creater id'
AND TBNAME = 'table-name'
AND KEYSEQ > 0
ORDER BY KEYSEQ

a nonzero value for KEYSEQ indicates the place of a column in
the primary key.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is ibm db2 open source?

589


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

1238


Mention the definition of cobol in varchar field.

700


What is alias in db2?

572


What is buffer pool in the db2 database?

621






What is buffer pool?

613


Why do chiropractors use drop table?

663


What is the physical storage length of timestamp data type?

646


What are the contents of dclgen?

661


What is the role of the data page in the db2 database?

589


How do I add a column to a table in db2?

623


How can the duplicate values be eliminated from db2 select?

633


Are view updateable?

629


List out the data types available.

704


What is consistency token in db2?

644