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

Answers were Sorted based on User's Feedback



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

Answer / kums

you could use SYSIBM.SYSINDEXES table to know more about
the table index.

Is This Answer Correct ?    7 Yes 0 No

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

Answer / nkv

Use the table name in SYSINDEXES to get the Primary index
name. The Primary index will have the value ā€˜Pā€™ against
UNIQUERULE column in this table. Use this index name in
SYSKEYS table to get the column(s) in Primary key.

Is This Answer Correct ?    1 Yes 0 No

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

Answer / priya shankar

If a column of the table uniquely defines each row in the
table then that column is called the Primary Key. Please
correct me if I am wrong.

Is This Answer Correct ?    9 Yes 9 No

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

Answer / 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

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

Answer / ambika

u can use sysibm.syskeys to view the primary key of a
particular table provided if u have declared any attribute
as NOT NULL. if there are multiple columns of such kind u
the above procedure wont help.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More DB2 Interview Questions

How do you do the EXPLAIN of a dynamic SQL statement?

2 Answers  


Which transaction use a command thread ?

1 Answers  


What is a SELECT statement?

1 Answers  


what is commit & rollback? When and where is used while compiling a cobol-db2 program?

2 Answers  


How to insert more than one record using insert?

7 Answers   Atos Origin, IBM,






What is query for your birthday date should be in hours,minute and seconds format?

1 Answers   Fidelity,


database DSNDB01 means a.db2 catalog b.db2 directory c.BSDS d.active logs answer with reason please

1 Answers  


In my table having 100 Rec. How can I delete the 7th row?? (we don't know what is data inside the table)

9 Answers   IBM,


how to resolve -818 error. how to see timestamp token in load module and plan

4 Answers   IBM,


If we have 100 records in the PF, we deleted all the records then what is the Size of the PF?

2 Answers  


Usually, which is more important for DB2 system performance - CPU processing or I/O access?

1 Answers  


What are host variables in db2?

0 Answers  


Categories