finding all stored procedures that is calling functions

Jinal Contractor 121 Reputation points
2020-10-19T17:18:59.35+00:00

Hello,
I would like to find all the stored procedures that has reference of Functions or called Functions from Store procedures.
I found some slow performance issue from one of stored procedures that is calling functions.
I would like to get whole list if I can find all the functions that been called from Stored procedures.

Thank you!

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,627 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,620 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tom Cooper 8,466 Reputation points
    2020-10-19T18:20:51.473+00:00
    Select Schema_Name(p.schema_id) As ProcedureSchema, p.name As ProcedureName, Schema_Name(f.schema_id) As FunctionSchema, f.name as FunctionName
    From sys.sql_expression_dependencies d
    Inner Join sys.objects p On p.object_id = d.referencing_id And p.type_desc = 'SQL_STORED_PROCEDURE'
    Inner Join sys.objects f On f.object_id = d.referenced_id And f.type In ('AF', 'FN', 'FS', 'IF', 'TF');
    

    Tom


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.