I have a temporary table that contains a list of function names and I want to find all the stored procedures that mention one of those function names in the stored procedure code to be a new row in the query results.
This is what I've been trying:
--Gets list of functions and puts them into a new temp table.
Select *
into #functionList
from
(
SELECT name
FROM sys.sql_modules m
INNER JOIN sys.objects o
ON m.object_id=o.object_id
WHERE type_desc like '%function%'
) as myFunctionList
--The following SQL will get me a list of stored procedures where the contents of the stored procedure
--contains a word I want to look up.
SELECT DB_NAME() as DB_Name
,name AS Procedure_name
,SCHEMA_NAME(schema_id) AS Schema_name
,Type_desc
,Create_date
,Modify_date
FROM sys.procedures
WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE "%MyWord%"
The last step has me stumped because instead of looking up "MyWord" I want to to check each result I have in the temporary table. I'm currently trying to see if I can get this with using a subquery but I'm not having much luck.