DECLARE @ObjectName VARCHAR(500) SET @ObjectName = 'dbo.sp_test_Proc' -- shows objects that the named object depends on SELECT DISTINCT OBJECT_NAME(DEPID) DEPENDENT_ON_OBJECT, OBJECT_NAME (ID) OBJECTNAME FROM SYS.SYSDEPENDS WHERE ID = OBJECT_ID(@ObjectName) -- shows objects that use the named object SELECT DISTINCT OBJECT_NAME(DEPID) OBJECT_NAME, OBJECT_NAME (ID) USED_IN_OBJECT FROM SYS.SYSDEPENDS WHERE DEPID = OBJECT_ID(@ObjectName)
I am sure I will get a lot of milage out of this in the future.
No comments:
Post a Comment