in

code for eternity !!!

community website for .net freaks ;-)

Technology

Using sp_depends to find all Stored Procedures which reference / use a Table

We can use the sp_depends system stored procedure to find all stored procedures which reference / use a particular table. The following T-SQL command will return a list of all database objects which are referencing / using the Products table:

EXEC sp_depends Products

Since the result set(s) returned by executing the above T-SQL command consists of all database objects (and not only stored procedures) which depend upon the Products table, we need to only look at the records which have type as "stored procedure" to know of all stored procedures which reference / use the Product table. Similarly, we need to only look at the records which have type as "view" to know of all views which reference / use the Products table.

Cheers,
Raj

~~~ CODING FOR ETERNITY !!! ~~~

Published Jan 20 2008, 03:10 PM by raj
Filed under:

I would really appreciate votes / kicks for this blog post if you found it useful ;-)

  kick it on DotNetKicks.com     Receive Email Updates


Comments

 

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

February 21, 2008 4:14 AM

Leave a Comment

(required)  
(optional)
(required)  
Add


StopGlobalWarming.org  
Powered by Community Server (Non-Commercial Edition), by Telligent Systems