B
basilbrush
I have a database of various related tables.
On a regular basis I will be provided with an updated set of primary
keys for one of my main tables. What I want to be able to do is to use this
to update my table by (i) Deleting records where the key is not in the new
set and (ii) adding a 'blank' record for each new key in the updated set.
Ideally, I would want all records in other tables using one of the deleted
keys (as a foreign key) to also be deleted.
I've been racking my brains but I can't seem to think of a 'slick'
solution for this seemingly simple task.
As a compromise, I could reduce my database to just one table then I
won't have to worry about referential integrity issues but I'm still not
sure on the best approach.
Any advice or pointers in the right direction will be very much
appreciated.
Thanks.
Basil.
On a regular basis I will be provided with an updated set of primary
keys for one of my main tables. What I want to be able to do is to use this
to update my table by (i) Deleting records where the key is not in the new
set and (ii) adding a 'blank' record for each new key in the updated set.
Ideally, I would want all records in other tables using one of the deleted
keys (as a foreign key) to also be deleted.
I've been racking my brains but I can't seem to think of a 'slick'
solution for this seemingly simple task.
As a compromise, I could reduce my database to just one table then I
won't have to worry about referential integrity issues but I'm still not
sure on the best approach.
Any advice or pointers in the right direction will be very much
appreciated.
Thanks.
Basil.