Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Posts
    114

    Unanswered: Multiple Foreign Keys

    I am having trouble creating multiple foreign keys on a table so that I can set up cascading update and cascading delete from two different primary tables. I am using the diagram to do this but when I try to save the diagram I get the following error.



    ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_IndResults_RaceData'. The conflict occurred in database 'VIRA', table 'RaceData', column 'RaceID'.



    What would cause this to happen? Is it possible that I have records in the foreign table that do not transfer back to the primary table?

    Thanks!

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Bobba Buoy
    Is it possible that I have records in the foreign table that do not transfer back to the primary table?
    Not just possible, nearly guaranteed.

    The best answer is to create a query that will show you the offending rows, then go and fix them. You can often pick a value that makes a reasonable default (sometimes NULL works well, meaning there isn't any relationship). Sometimes you've got to figure out what FK value you need, which can be a lot of work.

    -PatP

  3. #3
    Join Date
    Apr 2003
    Posts
    114
    Thanks! That was exactly what it was and it is fixed!

Posting Permissions

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