Book a Demo

Author Topic: Newbie question - Creating foreign key constraints  (Read 2413 times)

AJF

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Newbie question - Creating foreign key constraints
« on: March 07, 2012, 11:29:06 pm »
Using EA 9.2.921, I am creating a Data Modelling Diagram targeting SQL Server 2005 (it's actually 2008 but EA doesn't have that option) and I am trying to define the foreign key relationships. I have an association between 2 tables (User and ActivityLog) and have set the Multiplicity (one to zero-or-more).
  • Source = User (PK = UserID ; Multiplicity = 1)
  • Target = ActivityLog (PK = Timestamp+UserID ; Multiplicity = 0..*)
If I right-click on the association and select Foreign Keys, I get the Foreign Key Constraint dialog. I assume I need to select the participating fields in each table and add them to the lists at the bottom of the dialog, but I can't see a way to do this.
  • If I just select the UserID in the source and target and hit Apply, I get All primary key columns must be selected!
  • If I also select the timestamp field in the Target table, I get Number and Types of selected columns do not match
  • If I select no fields at all, then the Apply button reports no errors but when I generate the DDL, no foreign key constraints are created.
So what is the correct way of specifying foreign key constraints?

TIA,

--- Alistair.