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

what is difference between Static call and Dynamic call? How does it function?

1 Answers   Syntel,


What is dbrm? What it contains? When it will be created?

0 Answers  


What is an access path?

3 Answers  


For unmatched rows returned from an outer join, the column values in the other table are set to null e.g If A OUTER JOIN B returns some unmatched rows from A, the corresponding column values in B will be set to null. What can be done so that a null value is not displayed for these columns?

3 Answers  


How do I handle -911 (deadlock) error in a db2 program so that the program will never abend?

3 Answers   CTS, IBM,






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.

0 Answers  


What are column-name qualifiers used?

1 Answers  


What is sqlca’s maximum length?

0 Answers  


What is a collection in db2?

0 Answers  


How to check table size in db2 sap?

0 Answers  


Is schema the same as database?

0 Answers  


how do u update the faltfile into db2 table ?

4 Answers   RBS, TCS,


Categories