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.
精彩评论