January 28, 2010 at 8:38 pm
Hi - Just wanted to ask of what would be a good implementation in deleting records from a certain table (lets say Table A). But with the following rules, Table A is referencing to Tables B,C,D, and E and so before deleting records from Table A we still need to delete records from Tables B,C,D, and E that are being reference from Table A.
Any thoughts?
Thanks,
James.
January 28, 2010 at 9:27 pm
Yes, you are correct. It would be better if you are going to delete like E,D,C,B and then A.
January 28, 2010 at 11:39 pm
Yep but I was hoping I could see some sample implementation on how to do script for this one.
Thanks.
January 29, 2010 at 12:04 am
If you really want to delete records from Table B, C, D & E after records on Table A are deleted; then you can define foreign key relations with ON DELETE CASCADE clause on Table A, B, C, D.
January 30, 2010 at 5:05 am
Thanks for the help guys, really appreciate it. I think the DELETE CASCADE would help.
Thanks,
James
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply