Sunday, July 13, 2014

SQL Server-find dependents objects (sps, Procs, Table & View)

Sometimes we forget Stored Procedures name that we have created for any specific action/process. At that case we can easily find out name of that procedure using below DB script.

It is also useful to find dependent objects when ever we want to drop any DB object as well find out all the objects having keyword you want to search for.

Following code will help you to find all the DB Objects i.e.Stored Procedures,Tables,Views which are related to one or more specific tables. sp_help and sp_depends does not always return accurate results.

FROM syscomments sc
INNER JOIN sysobjects so ON
WHERE sc.TEXT LIKE '%sapdb.dbo%'


Powered by Code Imagine