Is there an easy way to chase down table/stored procedure/function dependencies in SQL Server 2005+? I\'ve inherited a giant application with lots of tables and even more s
From MSDN:
SELECT * FROM sys.sql_expression_dependencies
WHERE referenced_id = OBJECT_ID(N'Production.Product');
We can make it fancier:
select
I.name depending, I.xtype dependingtype,
E.name depended, E.xtype dependedtype
from sys.sql_expression_dependencies D
left outer join sysobjects I on D.referencing_id = I.id
left outer join sysobjects E on D.referenced_id = E.id
where 1 = 1
and ( E.name = 'mytable' or I.name = 'mytable' ) -- customize this any way you want
order by dependedtype, depended, dependingtype, depending
I don't think it's a guaranteed-complete list, but in Management Studio you can right click on a table or stored procedure and choose the View Dependencies
option.