SQL FOREIGN KEY conflict help!

  • I have two tables and I keep getting an FK conflict error on some of the data being inserted and cannot work out why!

  • Because you have made foreign key as MatchID, where as it should be Venue ID.

    CONSTRAINT fk_VenueID FOREIGN KEY (MatchID)

    It should be :-

    CONSTRAINT fk_VenueID FOREIGN KEY (VenueID)

    You create 10 rows for Venue table so after. SO there are 1-10 venue id and when you try to insert 11th row in Match table, you get FK violation error.

  • Thank you very much, that has solved that problem but also created another which probably needs a similar fix!

    When I try to insert data into my MatNat table, it only does the first 10 and ignores everything after!

  • What error it is giving. You have given data for only MatNat table, so I can't replicate it.

    But Check the value of Hotel, Nation & Match Table to see if the value exists in these tables what you are trying to insert.

  • Have Pm'ed you

  • Thanks!:-)

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply