Saturday, June 9, 2012

Updatin and deletion rules in sql server

Delete rules
On delete No action.
On delete set null.
On delete cascade.
On delete set default.

These rules coming into when we define the parent child relationship between 2 tables in sql server.

we need to define the rule while creating the child table. I mean to say while defining the foreign key we need to define the rules. the same thing applies for updation also

ex
Create table emp(eno int primarykey, ename varchar(50), Dno int references dept(dno) on delete no action)


Updation Rules
On update No action.
On update set null.
On update cascade.
On update set default.















No comments:

Post a Comment