Topic
3 replies Latest Post - ‏2012-03-01T15:51:00Z by SystemAdmin
SystemAdmin
SystemAdmin
374 Posts
ACCEPTED ANSWER

Pinned topic Issues creating keys/foreign keys connections between tables

‏2012-02-29T19:44:37Z |
I'm currently working a i5/OS -DB2 system, and using DDS sources to create tables, not DDL's. I'm using InfoSphere Data Architect to create a diagram to show the relation of some tables in a database. Its just being used to have a visible ER diagram to print out, along with a report with all the columns in the tables.

Lets say you have two tables, with the following attributes:

(First table)
Name of Table:
CustLocation

Columns:
CLCustname (Primary key)
CLAddress (Primary key)
CLCity (Primary key)
(second table)
Name of Table:
CustContact

Columns:
CCCustname (Key / FK from CustLocation-CLCustName)
CCAddress (Key / FK from CustLocation-CLCustAddress)
CCPhone

I added these two tables to a Physical Data Diagram. Then while hovering over the table CustContact and selecting "click and drop to create connection", to show how the keys are related to CustLocation. When this is done all the column keys in CustLocation are copied over to the table CustContact, so that table now has the following columns:

CCCustname (FK from CustLocation-CLCustName)
CCAddress (FK from CustLocation-CLCustAddress)
CCLoanNum (FK from CustLoan-CKLoanDate)
CLCustname (FK)
CLAddress (FK)
CLCity (FK)
CCPhone

Needless to say, I don't want it copying any columns over at all, because the FK columns are already there with different names. I just want it to make the connection between the two columns in the tables, not create all new columns, plus creating even the other key column (CLCity) that has no relation in CustContact. I've tried right clicking on a table and selecting, Add Data Object -> Foreign Key, and get the same results.
Updated on 2012-03-01T15:51:00Z at 2012-03-01T15:51:00Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    374 Posts
    ACCEPTED ANSWER

    Re: Issues creating keys/foreign keys connections between tables

    ‏2012-02-29T19:55:47Z  in response to SystemAdmin
    Ignore the column, CCLoanNum (FK from CustLoan-CKLoanDate). Forgot to delete it when editing original post before submitting.
  • null
    null
    59 Posts
    ACCEPTED ANSWER

    Re: Issues creating keys/foreign keys connections between tables

    ‏2012-02-29T20:24:39Z  in response to SystemAdmin
    If you don't want columns automatically add to child table, you can disable "key Migration" in preference page:

    Preferences-->Data Management -->Key Migration --> On Add,
    uncheck "Migrate key automatically".

    Thanks,
    -April
    • SystemAdmin
      SystemAdmin
      374 Posts
      ACCEPTED ANSWER

      Re: Issues creating keys/foreign keys connections between tables

      ‏2012-03-01T15:51:00Z  in response to null
      Hi April,

      That appears to be doing the job, thanks. Problem is a lot of the keys and foreign keys in the databases I'm working with are not physically labeled as so, but is more considered common knowledge they are. Thanks again.

      -David