Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,
How to find all dependent tables in one particular table
thanks.
Posted

Option 1: Right-click on a table and choose 'View Dependencies'.

Option 2:List tables which are dependent on a given table

SQL
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('WB_EMPLOYEE')



in the above replace WB_EMPLOYEE with your table name.

Try this

or

Check this
http://tech-trinkets.blogspot.com/2009/02/get-all-dependent-objects-on-specified.html[^]
 
Share this answer
 
v2
Comments
hitech_s 7-Nov-11 2:27am    
it works fine .......
my 5!
P.Salini 7-Nov-11 2:30am    
Thank you Hitech_ssc
To see all the dependency info, use the following:

SQL
SELECT referencing_schema_name, referencing_entity_name,
referencing_id, referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('YourObject', 'OBJECT');


More info:

http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/[^]
 
Share this answer
 
Use the following script to get correct dependency:

HTML
SELECT referencing_schema_name, referencing_entity_name,
referencing_id, referencing_class_desc, is_caller_dependent
FROM sys.dm_sql_referencing_entities ('YourObject', 'OBJECT');
GO
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900