Skip to content

Instantly share code, notes, and snippets.

@josuebasurto
Created June 6, 2014 15:48
Show Gist options
  • Select an option

  • Save josuebasurto/1ba5b67a3426f148656e to your computer and use it in GitHub Desktop.

Select an option

Save josuebasurto/1ba5b67a3426f148656e to your computer and use it in GitHub Desktop.
Query to find text in the content of stored procedures of a database in SQL Server
DECLARE @Search varchar(255)
SET @Search='Email_Create' --Text to search
SELECT DISTINCT 'SP_HELPTEXT ' as [SP_HELPTEXT],
o.name AS Object_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 '%'+@Search+'%'
ORDER BY 2,1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment