title: Select * from table where column1 LIKE column2
body: <p>Fetching only those rows, where value in column1 contains or is like value in column2 of the same table and same row.</p>
  
  <p>E.g, if table looks something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/VGrjr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VGrjr.jpg" alt="enter image description here"></a></p>
  
  <p>But I only want to fetch rows where value of column1 matches a part of column2, like this:</p>
  
  <p><a href="https://i.stack.imgur.com/fobMy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fobMy.jpg" alt="enter image description here"></a>
  I.e. either col1 like col2 or col2 contains col1, that returns.</p>
  
  <p>For the same I have generated a column with like pattern and used the same pattern in where condition as follows:</p>
  
  <pre><code>SELECT '''%''' + cast(t.col1 AS varchar(200))+ '''%''' as MatchThis,
  FROM [practice].[tables].[Temp1] t
  WHERE t.col2 LIKE '''%''' + cast(t.col1 AS varchar(200))+ '''%'''
  </code></pre>
  
  <p>This ain't helping, maybe because <code>LIKE</code> always takes a hard coded QUOTED value and compares it with all the resultant rows of the query.</p>
  
  <p>I have tried with <code>CONTAINS</code> as well, but that doesn't work either.</p>
  
  <p>Stuck in this now, is there any other way out.</p>