There are no primary or candidate keys in the referenced table that match the referencing column list in the foreign key

后端 未结 4 528
温柔的废话
温柔的废话 2020-11-30 07:12

In SQL Server , I got this error ->

\"There are no primary or candidate keys in the referenced table \'BookTitle\' that match the referencing colum

4条回答
  •  离开以前
    2020-11-30 08:01

    BookTitle have a Composite key. so if the key of BookTitle is referenced as a foreign key you have to bring the complete composite key.

    So to resolve the problem you need to add the complete composite key in the BookCopy. So add ISBN column as well. and they at the end.

    foreign key (ISBN, Title) references BookTitle (ISBN, Title)
    

提交回复
热议问题