As simple as this process is, I have had many people ask me "How do I look for all stored procs that use a certain table or field?". Here's the simple answer:
SELECT ROUTINE_NAME rn, ROUTINE_DEFINITION rd, *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%sstpay%'
AND ROUTINE_TYPE='PROCEDURE'
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%sstpay%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
Have Fun!
SELECT ROUTINE_NAME rn, ROUTINE_DEFINITION rd, *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%sstpay%'
AND ROUTINE_TYPE='PROCEDURE'
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%sstpay%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
Have Fun!
Comments