I recently had to reverse engineer a third party schema that was playing up and part of this was to find out what procedures and functions could be called by a particular object. I've written this recursive report that can tell you.It's a little rough and ready but if you need something like this you can customise it.It won't help you track sub executions that are the result of dynamic SQL so beware of that.The only parameter is the @objectName -- you can either set this to a procedure or function name or leave NULL to get all the objects.Here it is/*** Generate Procedure and Function Dependancy Chart *************************** Makes a tree list of object(s) dependancies. Set @object to the desired* object name or leave NULL to bring back all objects.** Charlie (2010-04-15)*******************************************************************************/DECLARE @object VARCHAR(255) SET @object = NULL/*****************************************************************************/; WITH ObjectTree AS ( SELECT o.[name] AS [Base Object] , CAST('' AS SYSNAME) AS [Dependant Object] , o.[xtype] AS [Object Type] , o.[ID] AS [Object_ID] , CAST('' AS VARCHAR(MAX)) AS [Execution Path] , 0 AS [Level] FROM sys.sysObjects o WHERE o.xtype IN ('P', 'FN') AND (o.[name] = @object OR @object IS NULL) UNION ALL SELECT ot.[Base Object] , o.[name] AS [Dependant Object] , o.[xType] AS [Object Type] , o.[ID] AS [Object_ID] , ot.[Execution Path] + CAST( CASE ot.[Execution Path] WHEN '' THEN o.[name] ELSE ' -> ' + o.[name] END AS VARCHAR(MAX)) AS [Execution Path] , ot.[level] + 1 FROM ObjectTree ot JOIN sys.sysDepends sd ON sd.[ID] = ot.[object_ID] JOIN sys.sysObjects o ON o.[ID] = sd.[depID] WHERE o.xtype NOT IN ('U', 'V') AND ot.[Execution Path] NOT LIKE '%' + o.[name] + '%' )SELECT [Base Object] , [Dependant Object] , [Object Type] , [Execution Path]FROM ObjectTree ORDER BY [Base Object] , [Execution Path]OPTION (MAXRECURSION 50);
Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION