Click here to Skip to main content
15,122,251 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is the no action in the insert and update spacification works for the delete only in sql server or it works for the update too


because when i tried to update the parent record in one table no error appers to explain that i cant update the record and the record got updated


but when i tried to delete the role works and error appears

What I have tried:

 i tried to update the parent record in one table no error appers to explain that i cant update the record and the record got updated 


but when i tried to delete the role works and error appears
Posted
Updated 19-Sep-19 6:38am
Comments
ZurdoDev 19-Sep-19 11:37am
   
When you update a record, you aren't updating the actual id that is part of the foreign key relationship. Right?

So, what exactly are you wanting to have happen?

1 solution

Your question is not entirely clear; but I'm guessing that you have a foreign key relationship between two tables, with both the UPDATE and DELETE set to "NO ACTION".

This will prevent you from deleting the parent record if any child records reference it.

It will also prevent you from updating the primary key of the parent record if any child record references it.

It will not prevent you from updating other columns on the parent record.
   
Comments
Member 14479161 19-Sep-19 11:45am
   
so if i set the primary key column as identity this future will not work correct i meant the update
Richard Deeming 19-Sep-19 11:58am
   
Identity or not, you can't update the primary key of a parent record which is referenced by child records.

There is nothing to prevent you from updating the columns on the parent record which are not part of the primary key.

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




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