Pages

Social Icons

Wednesday 15 February 2012

Find the dependency on an object

In SQL we can find the dependency of an object with the help of TSQL. I am writing the query below which returns the all the function, stored procedure and tables which are used in that object.



SELECT DISTINCT OBJECT_NAME(d.DEPID) DEPENDENT_ON_OBJECT, OBJECT_NAME (d.ID) OBJECTNAME,o.type_desc
FROM SYS.SYSDEPENDS D inner join sys.objects o on d.depid = o.OBJECT_ID
WHERE d.ID =  OBJECT_ID('<OBJECT NAME>')

No comments:

Post a Comment