Link to home
Start Free TrialLog in
Avatar of AlHal2
AlHal2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

track foreign key constraints through database hierarchy

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.
ASKER CERTIFIED SOLUTION
Avatar of esolve
esolve
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlHal2

ASKER

thanks.
Avatar of AlHal2

ASKER

thanks