views:

62

answers:

3

I tried exec sp_depends @objname = 'sfel.elpc' but I did not get any results, but I know the synonym is referenced in at least one stored procedure.

+1  A: 

You could try SQL Search by Red Gate, which is free. I'm by no means sure whether it supports synonyms, but might be worth a try if no other solutions are suggested.

AdaTheDev
Thanks for the heads up on this. I'm a fan of some of the red gate tools, but I was not aware of the one.
Dave
No worries - it's literally only just come out which is probably why you wasn't aware of it
AdaTheDev
+3  A: 

try:

SELECT DISTINCT
    o.name,o.type_desc
    FROM sys.sql_modules        m 
        INNER JOIN sys.objects  o ON m.object_id=o.object_id
    WHERE m.definition Like '%sfel.elpc%'
KM
+1 as it taught me what the approach is within TSQL
AdaTheDev
+1  A: 

this code is better:

SELECT 
*
FROM sys.sql_modules m 
    INNER JOIN sys.objects o ON m.object_id=o.object_id
WHERE m.definition Like '%sfel.elpc%' and type = 'p'

this code give you a more limited list of objects.

masoud ramezani
thanks, didn't even occur to me to do this, thanks!
Dave
**this code is better:**, huh? it is the same as my query (which I posted first). You only changed it to _SELECT *_ and limit it to return only procedures (which will result in it missing views and functions that could contain the target string)
KM