View previous topic :: View next topic
|
Author |
Message |
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Hi folks,
I was suppose to insert a value in to a table it shows -530 error. Its due to foreign key problem. But i cannot resolve it. I dont know the structure of that table. I searched the way in SYSIBM.SYSFOREIGNKEYS but i get the foreign key name not how it was related. I think if i came to know the description of the table i might solve this problem easily. How can i find the description of the table???? It s an emergency can anyone plz help me .
Thx in adv.../ |
|
Back to top |
|
|
thanooz
New User
Joined: 28 Jun 2005 Posts: 99
|
|
|
|
hi khamarutheen,
can you use Sysibm.syscolumns for display table strucrure;
Thank's
thanooz. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Hi Thanooz,
I too tried with that but i need the relationship of the keys. I can get the Foreign key but i want to know that key table's desc. Hope u catch my point. |
|
Back to top |
|
|
martin9
Active User
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
|
|
|
|
hy khamarutheen,
go to db2 administrator
and look at the table definitions a.s.o....
find it in ispf primary option menu
with g.d.2.a ...
martin9 |
|
Back to top |
|
|
thanooz
New User
Joined: 28 Jun 2005 Posts: 99
|
|
|
|
hi khamarutheen,
you can try with this sysibm.sysrels it gives the relationship of constarines;
SYSIBM.SYSRELS contains information about referential constraints, and each
constraint is uniquely identified by the creator and name of the dependent table and
the constraint name (RELNAME). SYSIBM.SYSFOREIGNKEYS contains
information about the columns of the foreign key that defines the constraint. To
retrieve the constraint name, column names, and parent table names for every
relationship in which the project table is a dependent, execute:
SELECT A.CREATOR, A.TBNAME, A.RELNAME, B.COLNAME, B.COLSEQ,
A.REFTBCREATOR, A.REFTBNAME
FROM SYSIBM.SYSRELS A, SYSIBM.SYSFOREIGNKEYS B
WHERE A.CREATOR = 'DSN8710'
AND B.CREATOR = 'DSN8710'
AND A.TBNAME = 'PROJ'
AND B.TBNAME = 'PROJ'
AND A.RELNAME = B.RELNAME
ORDER BY A.RELNAME, B.COLSEQ;
You can use the same tables to find information about the foreign keys of tables to
which the project table is a parent, as follows:
SELECT A.RELNAME, A.CREATOR, A.TBNAME, B.COLNAME, B.COLNO
FROM SYSIBM.SYSRELS A, SYSIBM.SYSFOREIGNKEYS B
WHERE A.REFTBCREATOR = 'DSN8710'
AND A.REFTBNAME = 'PROJ'
AND A.RELNAME = B.RELNAME
ORDER BY A.RELNAME, B.COLNO;
I think this will help's you
thank's
thanooz |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
Hi folks,
Thanks for u all for ur quick responses. I tried with all of the options and finally i m sorry to say that the foreign key defenition was defined incorrectly so only the data is not accepted. Its the mistake of the database designer. Any way the problem is solved. Once again thanks for all to share ur ways in our forum.... |
|
Back to top |
|
|
|