Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

i have two table Dept(parent) and emp(child).

both tables having deptno and deptno column in parent table is primarykey and deptno in emp table referential key.

i want change in deptno in dept table reflects in emp table also 

Posted
Updated 2-Feb-11 15:24pm
v2

1 solution

Use Triggers. Write an Update/Delete trigger on the Dept table such that if there's any change to the deptnp column, it does an update of the emp table as well.

 But it's usually not a good idea to keep updating/changing primary keys. The impact will felt only when the number of referenced records go up.

 
Share this answer
 

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