to update using cascade

Go down

to update using cascade

Post by aarthi on Thu Mar 18, 2010 2:22 pm

I created customer table with cust_id as primary key...and
then created a department table and used cust_id as its foreign key...
I tried updating the cust_id in the customer table bt got an error 'violations..child found'.
how to update cust_id in both the tables using CASCADE?

aarthi

Posts : 12
Points : 22
Join date : 2010-02-26

View user profile

Back to top Go down

Re: to update using cascade

Post by DineshThangaraju on Thu Mar 18, 2010 3:25 pm

@ aarthi,

How did u check whether cust_id is set as foreign key in department table ?

DineshThangaraju

Posts : 18
Points : 19
Join date : 2010-02-26
Age : 29
Location : India

View user profile

Back to top Go down

Re: to update using cascade

Post by aarthi on Thu Mar 18, 2010 3:33 pm

I am not able to enter value for cust_id for department table that is not in customer table.
it says integrity constraint violated parent-key not found!!!

aarthi

Posts : 12
Points : 22
Join date : 2010-02-26

View user profile

Back to top Go down

Re: to update using cascade

Post by Mahee on Tue Mar 23, 2010 2:31 pm

I think
using cascade you can delete all the record in dept table if the related row in cust table id deleted.. As for Update, You can update all the data except the related column(custid).
No point in using cascade to update the foriegn key by itself.
avatar
Mahee

Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia

View user profile

Back to top Go down

Re: to update using cascade

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum