Created
October 8, 2015 18:09
-
-
Save ewoo/eb582155d5572ec15faa to your computer and use it in GitHub Desktop.
Search for a specific string inside a SQL View object.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @search VARCHAR(1000) | |
SET @search = '%friendly%' | |
SELECT v.name, c.[Text] | |
FROM dbo.sysobjects AS v | |
INNER JOIN dbo.syscomments c ON c.id = v.id | |
AND CASE WHEN c.Number > 1 THEN c.Number | |
ELSE 0 END = 0 | |
WHERE v.type = 'V' AND c.[Text] LIKE '%' + @search + '%' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment