sp_depends System Stored Procedure

Displays information about database object dependencies ¾ the views and procedures that depend on the specified table or view, and the tables and views that are depended on by the specified view or procedure.

Syntax

sp_depends objname

where

objname
Specifies which database object to examine for dependencies. The object can be a table, view, stored procedure, or trigger.

Remarks

Executing sp_depends lists all objects, if any, that depend on objname and all objects, if any, on which objname depends (for example, views depend on one or more tables and can have procedures or other views that depend on them). An object that references another object is considered dependent on that object.

This system stored procedure determines the dependencies by looking at the sysdepends table.

The updated and selected columns in the report from sp_depends are meaningful if the object being reported on is a stored procedure or trigger. The values in these columns indicate whether the stored procedure or trigger updates or selects from that object.

References to objects outside the current database are not reported.

Example

This example lists the database objects that depend on the titles table.

sp_depends titles

Permission

Execute permission defaults to the public group.

Tables Used

master.dbo.sp_values, master.dbo.sysdatabases, sysdepends, sysobjects

See Also

CREATE PROCEDURE EXECUTE
CREATE TABLE sp_help
CREATE VIEW