Let’s say I have a row in Table A I wish to delete but there a multiple foreign key constraints in other tables. Is there a way to automatically generate the delete command?
I think a tool that would recursively look at the foreign keys and in turn generate a delete statement to take care of all foreign keys should exist, but I can’t find one.
I’m on MSSql server2008
When setting up your Foreign Key relationships there is an
ON DELETE CASCADEyou can add.MSDN Cascading Referential Integrity Constraints
SO even has a solution where you are not adding it to the table:
In SQL Server 2005, can I do a cascade delete without setting the property on my tables?