sql - The ALTER TABLE statement conflicted with the FOREIGN KEY constraint -


I have a problem when trying to add a foreign key to my tblDomare table; What am I doing wrong here? Make the table TblDomare (PersNR VARCHAR (15), FNamn VARCHAR (15), Nainan VARCHAR (20) No, zero, Erfarenhet VARCHAR (5), Primary key (PersonNN) ; INSERT (PersonN, F NAMN, E-NAMN, Ehrfrenhett) Mann in TBL Domora (6811034679, 'Beng', 'Carlberg', 10); INSERT (PersonN, F NAMN, ENAMN, Erfenhett) Value (76060 9 347, 'Josephine', 'Backman', 4) in TBL Doomarer; In TBL domare internet (PersonN, F NAMN, E-N.M., Erfetenet) Value (8508284163, 'Johanna', 'Backman', 1); Make Tablet TBLBena (Ban Nr Vachahar (15) Null, Primary K (Banar)); Include TBLABAN (BNNR) values ​​(1); Include TBLABAN (BNNR) values ​​(2); INSERT in TBLABAN (BNNR) values ​​(3); Optional Table TblDomare Add Foreign Key (PersNR) Reference TblBana (BanNR);

error message:

The temporary table is contradictory with the alleged foreign key constraint "FK_ tblDomare _PersN__5F7E2DAC". Conflicts in the database "Elmu 20004", the table "Debo. Tbbna", column "BanNR".

This happened because you have tblDomare.PERSNR to < Tried to create a foreign key from code> tblBana.BanNR , but do not match any values ​​in / and in tblDomare.PersNR value tblBana.BanNR Ate You can not create a relationship that violates the contextual integrity.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -