Find all the SP using specific tables or views


April 14, 2009
If you're new to my website, why don't get my latest posts using RSS Feed or by Email.

another tip »

Find in the database all the store procedures using specific tables or views.
Or list all the tables or view, which the specific Views or StoreProcudres use.

EXEC sp_depends @objname='tablename'

Sometime you want to check to see if any StoreProcedures or Views is using specific Views or StoreProcedures

SELECT DISTINCT o.name, o.xtype
FROM syscomments c
INNER JOIN sysobjects o ON c.id=o.id
WHERE c.TEXT LIKE '%tablename%'

Referece from:
Find Stored Procedure Related to Table in Database – Search in All Stored Procedure

Share
Under Category: SQL Code
Article Tags: , ,
July 14th, 2011
Umer

I didn’t know about the “EXEC sp_depends @objname=’tablename’ ”

awesome.

Trackbacks
Leave a Reply