1

We have a database that has been copied, including stored procedures and some user defined functions. I'd like to check whether a UDF is being used. Is there a way to see which stored procedures call the UDF?

2
  • Right-click >> View Dependencies
    – Steve
    Dec 3 '14 at 20:54
  • Thanks. However, the Object Dependencies dialog for a UDF function (which I know is called by an SP) does not show any objects that depend on it. The query by davisdba does show the dependency.... Dec 4 '14 at 4:11
2

You can find out the referencing entity dependencies for your function or any other database entities by using DMV dm_sql_referencing_entities. An example statement is as below.

Select 
referencing_schema_name, referencing_entity_name, 
referencing_id, referencing_class_desc, is_caller_dependent
from sys.dm_sql_referencing_entities ('dbo.ufn_MyFunction', 'OBJECT');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.