Identifying Objects Referenced in Stored Procedures

Because changing the name of a table can cause stored procedures to no longer work, you might want to identify which stored procedures reference a specific table so you know which stored procedures will be affected by changes to the table name or columns. You can view the dependencies between database objects by querying the sys.sql_dependencies object catalog view. Unfortunately, all you really see if you query the sys.sql_dependencies view is a bunch of numbers—just the IDs of the objects and columns that have a dependency relationship, along with some additional status information.

The better way to display a list of stored procedures that reference a specific table or view, or to display ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.