Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Saving Database Diagram

Author  Topic 

BrianC
Starting Member

4 Posts

Posted - 2009-08-10 : 05:11:28
Having created a simple database with two tables I have added the relationship between the tables successfully...I thought! However, on exiting the view and saying yes to save the diagram I get an error message that ends with "The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_ORDER LINES_ORDERS". The conflict occurred in database "Test_Movements", table "dbo.ORDERS", column 'ORDER_ID'.". Can anyone point me to where am I going wrong, please?

BrianC

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2009-08-10 : 05:36:49
Referential integrity problem
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-08-10 : 06:02:40
You have tried to add a foreign key that points to order_id in your orders table, yet your data is saying that you have data in the foreign key that doesn't exist in the primary key field.

Fix your data and you won't have a problem.
Go to Top of Page

BrianC
Starting Member

4 Posts

Posted - 2009-08-10 : 06:47:08
Thanks...that makes sense...problem solved.
Go to Top of Page
   

- Advertisement -