Rss Feed Like Us on facebook Google Plus

June 28, 2016

Find dependency of a particular object with all procedures/Objects of a database

There are various methods to finds the dependent objects , there is a system defined procedures sp_depends but it does not give perfect result always as it give results on the basis of creation order, more accurate ways are below

If we need to find paymentdetail table dependency on procedures/objects ,then  query

will be

FIND Dependency 

SELECT DISTINCT so.name
FROM sys.syscomments sc
INNER JOIN sys.sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%paymentdetail%'

OR

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



FIND Text in Procedures

select name  from sys.procedures
where OBJECT_DEFINITION(OBJECT_ID) like '%paymentdetail%'



© 2011-2016 Techimpulsion All Rights Reserved.


The content is copyrighted to Tech Impulsion and may not be reproduced on other websites.