Identifying object dependencies in SQL Server using SP_DEPENDS

Introduction

When developing components for SQL Server one change may affect another database object.  Finding these dependent objects should be straightforward, but in most cases it is not as easy as we would think. There are several methods of getting this information, in this article we will have a look using SP_DEPENDS a System Stored Procedure.

Syntax

exec sp_depends [ @objname = ] '<object>' 

The sp_depends  shows the following result set of the object depend on <object>.

Column nameData typeDescription
namenvarchar(257 )Name of the item for which a dependency exists.
typenvarchar(16)Type of the item.

Example

exec [sp_depends] @objname = N'[Details].[StudentPersonalDetails]';
Fig.1 Result set for the example table object

Conclusion

By using SP_DEPENDS system stored procedure, we can view all the object dependencies. This is also one of the approach to find the object dependencies. I assume this tip was very useful. Please share your feedback in the comment section.

Responses

  1. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  2. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  3. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  4. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  5. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  6. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  7. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  8. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  9. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

  10. […] Identifying object dependencies in SQL Server using SP_DEPENDS […]

    Like

Leave a reply to Create and Publish SQL Server Database Project With Visual Studio – Learn With Sundar Cancel reply