Referential Integrity Circles...

  • Hi,

    I've got a database that contains two main tables contacts and entities. Entities has multiple references to contacts (contacts is a chunk of contact information), but I can't maintain them through foreign keys with update cascade/delete cascade as there are many foreign keys referencing the same tables.

    What is the recommended way to ensure that referential integrity is maintained? 

    Kind Regards,

    Jamie

     

  • using triggers


    Everything you can imagine is real.

  • Would you suggest dropping all existing foreign key constraints in order to maintain referential integrity for this situation? I had tried using a mixed approach but as entities and contacts are used in many other tables I can't use an INSTEAD OF UPDATE trigger on either table?

  • I suggest that you keep the RI, but not the On Delete or On update.  Handle that through the application. 

  • Agree with Bob. Keep the RI, prevents errors with triggers as code changes.

  • Thanks for the replies. It makes sense - I was hoping there was an all encompassing solution that would allow this within SQL, but this will work going forwards. 

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply