Pages

Wednesday, December 26, 2007

tables which are dependent on a given table

Use the below query to get the list of tables that depends on the input table.


Select
S.[name] as 'Dependent_Tables'
From
sys.objects S inner join sys.sysreferences R
on S.object_id = R.rkeyid
Where
S.[type] = 'U' AND
R.fkeyid = OBJECT_ID('Person.StateProvince')

here, replace Person.StateProvince with your table name.

No comments: