Friday, December 3, 2010

How To Find Referenced Objects In SQL Server

Option:1 
This option is very handy you can use this sp_depends Stored procedure for for finding particular table used in which stored procedures or what are the tables used in a particular stored procedures etc...

Here I have used "table" in the below screenshot

 
Here I have used "Stored Procedure" for finding the related tables...


Option: 2  
You will get the same result from the below query like above one. 

SELECT DISTINCT A.name, A.xtype
FROM syscomments B
INNER JOIN sysobjects A ON B.id=A.id
WHERE B.TEXT LIKE '%AH_Vendor_Master%'


You can see xtype is "P" from above screen-shot, it means the particular table was used in Procedures, if it was used in Views then you will see something like "V"
Object Dependency in SQL Server, Identifying Object Dependencies in SQL Server, Find reference to object in sql server stored procs, Get the List of Object Dependencies in sql server 2012, Get the List of Object Dependencies in sql server 2008, Get the List of Object Dependencies in sql server 2005, Get the List of Object Dependencies in sql server 2012, Using Object Dependencies in SQL Server 2008, How to: View SQL Dependencies, how to check SQL Dependencies, if I want to find what's referencing an object in SQL Server, Referencing table in another SQL Server DB, Self Referencing Tables In SQL Server, 

0 comments:

Post a Comment