This code would make a handy little inline table valued function.
It currently filters out everything but letters and numbers.
Fairly quick, too.
declare @find varchar(50) = 'SET NOCOUNT ON'
declare @txt varchar(max) =
'Come and listen to my story bout a man named Jed
A poor mountaineer barely kept his family fed SET
NOCOUNT ON And then one day he was
shootin at some food, when up through the ground come
a-bubblin crude.';
set statistics time on;
with test as (select top(len(@txt)) ''+substring(@txt,N,1) as txtchar
from vtally)
SELECT 'EXISTS'
WHERE (select ''+txtchar
from test
where txtchar BETWEEN 'A' and 'Z'
or txtchar BETWEEN '0' and '9'
FOR XML PATH(''), TYPE).value('./text()[1]', 'varchar(max)')
LIKE '%'+REPLACE(@find,Space(1),Space(0))+'%'
set statistics time off;
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills