How to Check The Dependency Of Function in store procedure Using Query in sql server ?

Forums SQLHow to Check The Dependency Of Function in store procedure Using Query in sql server ?
Staff asked 7 months ago

Answers (1)

Add Answer
Niki Tandel Marked As Accepted
Staff answered 7 months ago

Use below Query

DECLARE @ObjectType VARCHAR(25)= 'P'; 
DECLARE @Code VARCHAR(25)= 'Your function name';
SELECT
s.name + '.' + o.name, m.definition
FROM
sys.sql_modules AS m
INNER JOIN sys.objects AS o ON m.object_id = o.object_id
INNER JOIN sys.schemas AS s ON o.schema_id = s.schema_id

WHERE o.type = @ObjectType
--AND o.name NOT LIKE 'sp_%'
AND m.definition LIKE '%' + @Code + '%'
ORDER BY
s.name

 

Subscribe

Select Categories