devxlogo

Locate All Stored Procedures and Their Objects/SQL Tables

Locate All Stored Procedures and Their Objects/SQL Tables

Sometimes, for documentation purposes, you need to locate all the stored procedures and objects/SQL tables upon which they depend. The following code shows you how:

select distinct A.name as sproc_name, C.name as dep_obj_name, C.xtype as dep_xtypefrom sysobjects Ainner join sysdepends SD on A.id=SD.idinner join sysobjects C on SD.depid=C.id and C.xtype in ('S', 'U', 'P', 'FN')where A.xtype = 'P'and   C.xtype = 'U'AND   A.Status > 0order by A.name, C.name

devx-admin

Share the Post: