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

When one binds a PACKAGE ( of a plan ) what package information is stored and where it is stored?

3 Answers  


What does the sqlcode of -818 pertain to?

3 Answers  


Where are plans stored?

2 Answers  


how to resolve -805 . how to see dbrm and package not found

2 Answers   IBM,


In a Cobol-DB2 program, I am fetching rows from 4 tables using cursor and then based on the a field present in that table, It processes the information accordingly..for example stat-c is one digit field..if stat-c is 'D' then the a row is deleted from table and written those details in to a file. If the stat-c is 'U' then a row is updated (hardcoded what to update)in a table and written those details in to a file. If the stat-c is 'I' then a row is inserted in a table and written those details in to two files. The issue is i have to include the intermediate commits. When an abend occurs, due to commit statement db2 tables will be saved, But there will be lose of file contents. When we resubmitting the job associated with this program there will be insert ,update and delete anomolies to avoid that what measures could be taken?. The intermediate commit is nothing but issuing commit after massive inserts, updates and deletes(sum of 500actions)

2 Answers  


Mention a credible reason why select* is never given preference in an sql program that has been embedded.

0 Answers  


What is a synonym ?

2 Answers  


how many partitions are possible in partitioned tablespace? dont say 1-64. a)240 b)256 c)512 d)none

8 Answers   Amdocs, HeadStrong,


What does DML stand for and what are some examples of it?

3 Answers   IBM,


I have a main program (A) where we delete some rows in table in a cursor, and we commit it in sub program(B). What will happen - will we get an error or not?

2 Answers  


How to find the maximum value in a column in the db2 database?

0 Answers  


Explain about open switch business continuity software?

0 Answers  


Categories