Friday, February 24, 2012

How to find Dependent/Referenced Objects of a Stored Procedure?

Hi Frens,

Could anybody tell me how can I find all the database objects that are used in /referenced by/called by/dependent on a given stored procedure? In other words, I am looking for something like a stored procedure or a function that takes as input the name of a stored procedure and outputs all the names of the tables, functions, procedures, cursors and etc. database objects that are used in that procedure. Could you please give me suggestions or possible answers for this?

Thanks a lot for your time.
Regards,
-Ram.Sure, take this query here:

Select OBJECT_NAME(id),OBJECT_NAME(depid) from sysdepends

WHERE id = OBJECT_ID('YourPrcoedurename')

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||Thanks Jens.

No comments:

Post a Comment