Я пытаюсь выполнить скрипт базы данных, который я создал с помощью надстройки Forward Engineer для Microsoft Visio.
Ниже приведены ошибки, которые я получаю, и раздел кода, на который ссылается сообщение об ошибке:
Ошибка 1:
Msg 1776, Level 16, State 0, Line 12
There are no primary or candidate keys in the referenced table 'dbo.Account_BillingAccount' that match the referencing column list in the foreign key 'Account_BillingAccount_InvoiceDetail_FK1'.
Msg 1750, Level 16, State 0, Line 12
Could not create constraint. See previous errors.
Код ссылки 1:
ALTER TABLE [dbo].[InvoiceDetail] WITH CHECK ADD CONSTRAINT [Account_BillingAccount_InvoiceDetail_FK1] FOREIGN KEY (
[BillingAccountNumber]
, [AccountNumber]
)
REFERENCES [dbo].[Account_BillingAccount] (
[BillingAccountNumber]
, [AccountNumber]
)
Ошибка 2:
Msg 1776, Level 16, State 0, Line 2
There are no primary or candidate keys in the referenced table 'dbo.ManagerContract' that match the referencing column list in the foreign key 'ManagerContract_RegionalCoordinators_FK1'.
Msg 1750, Level 16, State 0, Line 2
Could not create constraint. See previous errors.
Ссылка на код 2:
ALTER TABLE [dbo].[RegionalCoordinators] WITH CHECK ADD CONSTRAINT [ManagerContract_RegionalCoordinators_FK1] FOREIGN KEY (
[AssociateID]
, [WritingNumber]
)
REFERENCES [dbo].[ManagerContract] (
[AssociateID]
, [WritingNumber]
)
Какой самый эффективный способ устранения вышеупомянутых ошибок?