Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Unable to create relationship 'FK_amount1_homeshop1'. The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_amount1_homeshop1". The conflict occurred in database "C:\NETPROJECTS\WPFPROJECTS\HOMEPROJECT\HOMEPROJECT\APP_DATA\DATABASE1.MDF", table "dbo.homeshop1", column 'cust_Id'.plaese save from this problem
Posted
Comments
What is the query?
Andy Lanng 2-Jun-15 7:46am    
You need to ask a question >_<
I assume your question is "Why am I getting this error?"?
It's because your data is dirty. Something in the table is not a valid key from the other table.
HobbyProggy 2-Jun-15 9:00am    
1. Query please
2. DB structure
3. Testdata
4. Dependencies you want to create

If you can give us these points we might have a solution for you mate :)

1 solution

Foreign key used to force a relation between two tables...practically it means that a field in TABLE A can get values only from the specified field from TABLE B...When you are creating a FK, SQL runs an integrity check to see if relation exists for the already created records, if not the creation will fail...
You have two options:
1. Create FK without integrity check (WITH NOCHECK)
2. Fix data in your table...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900