title: SQL Server - Partial String match - two columns of different tables
body: <p>I am in need of a query (or stored procedure rather) for SQL Server wherein I need compare data of two different tables with the following structure</p>
  
  <p><strong>Table 1</strong></p>
  
  <pre><code>ID       Text       Table2ID
  1        Chris   
  2        John
  3        Paul
  </code></pre>
  
  <p><strong>Table2</strong></p>
  
  <pre><code>ID       Text
  1        Mitchell Johnson
  2        Chris Martin
  3        Steven
  </code></pre>
  
  <p>By comparing the above two tables, I need to get the 'IDs' from table2 and insert them into the 'Table2ID' column of first table</p>
  
  <p><strong>Comparison criteria:-</strong></p>
  
  <p>The full word in 'Text' column of 'Table1' should be contained in 'Text' column of 'Table2'</p>
  
  <p>In our case, we would obtain 'IDs' of first two rows from table2 (since the word John is contained in 'Mitchell Johnson' and the word Chris is contained in 'Chris Martin' and Paul is not contained in 'Table2')</p>
  
  <p>How could I achieve this? It would be nice if someone out here is able to shed light on my path</p>
  
  <p>Regards,
  Raghuraman.V</p>