SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Get all the Child Tables up to N level

By Thava,

Get all the dependent tables for a master table  up to N level(Till the leaf ) you can either find dependency or you can find all the child tables.
To find the  Complete Relation
SELECT TableRelation
FROM   cte
Order by TableRelation
To find only the Dependent Table only
FROM   cte

Total article views: 2695 | Views in the last 30 days: 2
Related Articles

Questions about Dependencies

Questions about Dependencies


It Depends

It depends. The mantra of many DBAs and others in IT. Steve Jones reminds us why it applies.


Find Dependencies

Here's a script from my toolbox I use to find dependencies between SQL objects.  The where clause ha...


Dependencies View 2008

Provides a list of dependencies for a stored procedure


Data Profiling Column Functional Dependency T-SQL

This article demonstrates Data Profiling Functional Dependency