track foreign key constraints through database hierarchy
Posted on 2013-01-25
A relational database may have table B having a foreign key constraint against table A and table C having a foreign key constraint against table A.
If I want to delete data from table A I must delete from table C then table B then table A.
Is there a way of finding all the tables dependant on a certain table within the hierarchy. I was thinking of a recursive CTE using system tables, but am open to any suggestions.
Any solution would need to work with SQL 2005.