Thursday, August 12, 2010

SQL Server: how to find view or stored procedure with specific text

You can query the system tables:

SELECT [name]
FROM [dbo].[sysobjects] obj
INNER JOIN [dbo].[syscomments] cmt
ON obj.[id] = cmt.[id]
where cmt.[text] like '%my text%'

0 comments: