If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Foreign Key problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-09-05, 20:38
nN2005 nN2005 is offline
Registered User
 
Join Date: Nov 2005
Posts: 2
Foreign Key problem

hi, im kinda new here and im using db2 v8.1.2.169, fixPak 2, on windows. My problem is that i have a Zoo entity with a foreign key not null referencing to the Primary Key of the Employee entity and a foreign key not null of Employee referencing to the Primary Key of the Zoo entity, i dont seem to be able to insert any data to the initial state of these 2 tables. my question is why and how do i do it.

~nick.
Reply With Quote
  #2 (permalink)  
Old 11-10-05, 00:20
sinwar sinwar is offline
Registered User
 
Join Date: Oct 2005
Location: pune(india)
Posts: 24
drop the relationship first.i mean drop one of the foreign key.then only you will able to insert data initially to both tables.....after insert reconstruct the relationship by altering the table whose foreign key was dropped.
....................anyways i don't understand purpose of such kind of design.(parent of each other)
Reply With Quote
  #3 (permalink)  
Old 11-10-05, 01:07
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by sinwar
....................anyways i don't understand purpose of such kind of design.(parent of each other)
Not to mention that in some states, such relationships are illegal.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 11-13-05, 17:34
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by sinwar
anyways i don't understand purpose of such kind of design.(parent of each other)
Maybe the "employee" rows contain a reference to the department where they work, and the "department" rows contain a reference to their head-of-department (in the employee table).
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #5 (permalink)  
Old 11-15-05, 13:38
nN2005 nN2005 is offline
Registered User
 
Join Date: Nov 2005
Posts: 2
Quote:
Originally Posted by Peter.Vanroose
Maybe the "employee" rows contain a reference to the department where they work, and the "department" rows contain a reference to their head-of-department (in the employee table).
exactly, that was the case. thx guys for the info.

~nick.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On