try this example-- prepare test datadeclare @test table (siteadd varchar(100))insert @testselect 'Highway' union allselect 'Highway Road' union allselect '36 Highway'declare @search table (what varchar(50))insert @searchselect ' ' union allselect 'road' union allselect 'way' union allselect 'y r' union allselect ' h' union allselect '6 ' union allselect 'high'-- do the workselect t.siteadd [This i have], '*' + s.what + '*' [This i search for], -- the stars is just there for clarification for the space search case when SiteAdd LIKE '%' + what + '%' then 'works ok' else 'fails' end Resultfrom @test tcross join @search sorder by 1, 2
Output is36 Highway * * works ok36 Highway * h* works ok36 Highway *6 * works ok36 Highway *high* works ok36 Highway *road* fails36 Highway *way* works ok36 Highway *y r* failsHighway * * failsHighway * h* failsHighway *6 * failsHighway *high* works okHighway *road* failsHighway *way* works okHighway *y r* failsHighway Road * * works okHighway Road * h* failsHighway Road *6 * failsHighway Road *high* works okHighway Road *road* works okHighway Road *way* works okHighway Road *y r* works ok
Peter LarssonHelsingborg, Sweden