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 db2 a mainframe database?

567


What are the different types of base tables?

585


Which component is responsible for db2 startup and shutdown?

630


What is the max length of sqlca?

764


Why do chiropractors use drop table?

662






How would the varchar column remarks defined?

635


What is with ur in db2?

760


How connect db2 database to datastage?

765


What are bind parameters in db2?

613


How to create backup table in db2?

644


What are iseries servers?

566


Is it possible to alter a table – for example adding a column, when another user is accessing or updating some columns?

630


What is db2 connect?

609


Why select is not preferred in embedded sql programs?

715


What is the difference between cursor and select statement?

615