Skip to content

Instantly share code, notes, and snippets.

@bhousel
Created February 25, 2015 15:32
Show Gist options
  • Save bhousel/062ee1787b426d3e8bf0 to your computer and use it in GitHub Desktop.
Save bhousel/062ee1787b426d3e8bf0 to your computer and use it in GitHub Desktop.
string search in Microsoft #SQL
DECLARE @search VARCHAR(255)
SET @search = '[10.10.100.50]'
SELECT DISTINCT
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