开发者

Error SQL04111: Visual studio 2010 database project

开发者 https://www.devze.com 2023-02-24 01:04 出处:网络
I have created a relation in my tables in visual studio 2010 database project and I am getting this error:

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:

AL开发者_开发问答TER 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 ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消