This file contains hidden or 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 @SQL VARCHAR(MAX) | |
DECLARE @SearchString VARCHAR(100) | |
SET @SQL = '' | |
SET @SearchString = 'some string here' | |
SELECT @SQL = @SQL + 'SELECT CONVERT(VARCHAR(MAX),COUNT(*)) + '' matches in column ''+''' | |
+ C.name + '''+'' on table '' + ''' + SC.name + '.' + T.name + | |
''' [Matches for '''+@SearchString+''':] FROM ' + | |
QUOTENAME(SC.name) + '.' + QUOTENAME(T.name) + ' WHERE ' + QUOTENAME(C.name) + |