I would like to find all the stored procedures that has reference of Functions or called Functions from Store procedures.
Here is the script;
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');
Add to favorites