Select * fro t1, t2
Where t1.col1 like '%' + t2.col1 + '%'
The problem is that this query runs on SQL SERVER 2008 R2, but does not work on SQL SERVER 2000 (it does not display any errors but does not terminate)
I waited 30 minutes and then I stopped.
On SL SERVER 2008 R2: this request displays the result in 48 seconds
I tried this:
Select * fro t1, t2
Where t1.col1 like t2.col1 + '%'
It works but does not work until after 2 minutes
I tried this:
Select * fro t1, t2
Where t1.col1 like '%' + t2.col1
If there are a lot of rows in T1 and T2 it will take a long time.
You are, of course, doing a JOIN with a cartesian product, so the number of rows for SQL to test is huge. It might well be that the optimiser in SQL2008 does a much smarter job of resolving the query.