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

后端 未结 4 531
温柔的废话
温柔的废话 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 07:55

    Another thing is - if your keys are very complicated sometimes you need to replace the places of the fields and it helps :

    if this dosent work:

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

    Then this might work (not for this specific example but in general) :

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

提交回复
热议问题