views:

33

answers:

2

Is there a way to find a usage of a function in SQL server 2008?

+1  A: 

Assuming that by "usage" you mean "usage statistics", then maybe SQL Server Profiler is useful for you.

Konamiman
+1  A: 

Use in code:

SELECT * FROM sys.sql_modules WHERE definition LIKE '%MyFunc%'
UNION
SELECT * FROM sys.computed_columns WHERE definition LIKE '%MyFunc%'
UNION
SELECT * FROM sys.check_constraints WHERE definition LIKE '%MyFunc%'
UNION
SELECT * FROM sys.default_constraints WHERE definition LIKE '%MyFunc%'

I think I've covered all bases...

You can't use sys.comments because the type is nvarchar(4000)

gbn