sp_depends (Transact-SQL)
Displays information about database object dependencies, such as the views and procedures that depend on a table or view, and the tables and views that are depended on by the view or procedure. References to objects outside the current database are not reported.
Important |
|---|
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use sys.dm_sql_referencing_entities and sys.dm_sql_referenced_entities instead. |
sp_depends displays two result sets.
The following result set shows the objects on which <object> depends.
Column name | Data type | Description |
|---|---|---|
name | nvarchar(257) | Name of the item for which a dependency exists. |
type | nvarchar(16) | Type of the item. |
updated | nvarchar(7) | Whether the item is updated. |
selected | nvarchar(8) | Whether the item is used in a SELECT statement. |
column | sysname | Column or parameter on which the dependency exists. |
The following result set shows the objects that depend on <object>.
Column name | Data type | Description |
|---|---|---|
name | nvarchar(257) | Name of the item for which a dependency exists. |
type | nvarchar(16) | Type of the item. |
A. Listing dependencies on a table
The following example lists the database objects that depend on the Sales.Customer table in the AdventureWorks2008R2 database. Both the schema name and table name are specified.
USE AdventureWorks2008R2; GO EXEC sp_depends @objname = N'Sales.Customer' ;
B. Listing dependencies on a trigger
The following example lists the database objects on which the trigger iWorkOrder depends.
EXEC sp_depends @objname = N'AdventureWorks2008R2.Production.iWorkOrder' ;

Important