How perform I settle this error: The change TABLE explain conflicted with the FOREIGN an essential constraint ......
You are watching: The alter table statement conflicted with the foreign key constraint
Aug 24, 2008 06:04 PM|haggis999|LINK
I am utilizing an SQL Server database v my carolannpeacock.com.NET 3.5 application, i beg your pardon is under advance using Visual net Developer 2008 refer (VWD). Ns wish to collection up assorted relationships in a database diagram withinthe Database Explorer home window of VWD. Ns have already created a couple of relationships without any problem but one particular example is giving me a problem.
The applications relates to a photographic competition.I have actually an participants table the lists all the world who have gone into the competition and also I have actually a distinguish table that listsawide range of possiblephotographic distinguish that may be possessed by any of the attendees - such together FRPS, for other of the imperial Photographic Society, or APSA, for Associate the the Photographic culture of America. Any given person may have actually several such distinctions, or none at all. I because of this have a third table, DistinctionsByEntrant,to list the many-to-many relationship between the Entrants and Distinctions tables.
TheDistinctionsByEntrant table simply has two columns, EntrantID and also DistinctionID (which kind a joint main Key). The DistinctionID is, of course, the Primary key in mine Distinctions table.
I started to set up a partnership in the database diagram in between the DistinctionsByEntrant and Distinctions tables. I selected the DistinctionID in the an initial table and also dragged it to the second table, in the regular manner. I accepted all the default settings in the Foreign an essential Relationship conversation box. However, as soon as I tried to save my database chart changes, I acquired the error message presented below. Mine database derives indigenous an earlier accessibility app and I am still very brand-new to SQL Server. Ns don"t understand the real an interpretation of this error. How do I solve it?
"Distinctions" table conserved successfully"DistinctionsByEntrant" table- unable to create relationship "FK_DistinctionsByEntrant_Distinctions". The change TABLE explain conflicted with the FOREIGN vital constraint "FK_DistinctionsByEntrant_Distinctions". The conflict emerged in database "C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL.2\MSSQL\DATA\COMPDATA2XSQLBE.MDF", table "dbo.Distinctions", column "DistinctionID".
See more: 2006 Toyota Sienna Bank 1 Sensor 2 Location Toyota Sienna 2006
Hi Mojtaabaa,Unfortunately, ns don"t know any slick ways to examine for unequaled records between two tables in Visual net Developer 2008 refer or in SQL Server monitoring Studio Express. However,this database also exists in an accessibility 2003 variation and access makes it very easy to create such queries. It didn"t take long to uncover out that I had actually one document in my DistinctionsByEntrant table the quoted a DistinctionID the does not exist in the distinguish table.
My problem is now solved. Thanks very much because that pointing me in the appropriate direction <:D>