Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Back to basics on foreign key constraint
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 6.5 and older
Application:
Web
Miscellaneous
Thread ID:
01582500
Message ID:
01582517
Views:
31
>>>Bill,
>>>
>>>Must be misunderstanding. I didn't say that CLASS_PK is the primary key in the PARTS table. It is the primary key in the PART_CLASS table (new table). (the PARTS table does have the primary key which is not relevant to this).
>>>
>>
>>OK.
>>
>>How did you go about setting the foreign key restraint?
>>
>>
>
>In SSMS I go to PARTS table, right mouse click on Keys and click on New Foreign Key. Then specify that Primary table is PART_CLASS with column CLASS_PK and Foreign table is PARTS with column CLASS_PK. In the UPDATE specification I set to Default on Delete.
>And then it fails on saving the table.

If that field has 0 in all rows, go ahead and add one row with 0 in the PART_CLASS table. Then you would be able to save your changes in the Parts table.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform