Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Unanswered: 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.

  2. #2
    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)

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

  5. #5
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •