Pages

Monday, November 10, 2008

Find all stored procedures that contain a particular string

SELECT    so.Name, so.xtype as Type
FROM    dbo.sysobjects so
    JOIN dbo.syscomments scm ON so.id = scm.id
WHERE scm.text like '%CorporationID%'
GROUP BY so.Name, so.xtype
or better yet:
SELECT  routine_name FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_definition LIKE '%..%'

No comments:

Post a Comment