Reputation: 10016
I'm trying to create a table called Enrollments with two attributes that reference the foreign keys of another table. The schema for Enrollments is:
I'm trying to make SectionNo
and Year
of Enrollments
reference SectionNo
and Year
of the CourseSections
table (already created). Here is the schema for that relation:
Here is how I'm trying to add the foreign key constraints when I create the enrollments table:
I'm getting the error:
SQL71516 :: The referenced table '[dbo].[CourseSections]' contains no primary or candidate keys that match the referencing column list in the foreign key. If the referenced column is a computed column, it should be persisted.
Upvotes: 0
Views: 1126