Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error SQL04111: Visual studio 2010 database project

I have created a relation in my tables in visual studio 2010 database project and I am getting this error:

Error SQL04111: The referenced table '[dbo].[tblAccount]' 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.

Here is the foreign key:

ALTER TABLE [dbo].[tblDispute]
    ADD CONSTRAINT [FK_AccountNo] 
    FOREIGN KEY (AccountNo)
    REFERENCES tblAccount ([Account No])  ON DELETE NO ACTION ON UPDATE CASCADE;

How can I fix it ?

like image 694
DotnetSparrow Avatar asked Mar 07 '26 05:03

DotnetSparrow


1 Answers

ok, I fixed the issue by adding the other column from account table. Account table has two column primary/composite key and in dispute table I was adding only one of the two tables.

like image 65
DotnetSparrow Avatar answered Mar 08 '26 19:03

DotnetSparrow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!