title: SQL Server : find percentage match of LIKE string
body: <p>I'm trying to write a query to find the percentage match of a search string in a notes or <code>TEXT</code> column.  </p>
  
  <p>This is what I'm starting with:</p>
  
  <pre><code>SELECT * 
  FROM NOTES 
  WHERE UPPER(NARRATIVE) LIKE 'PAID CALLED RECEIVED'
  </code></pre>
  
  <p>Ultimately, what I want to do is:</p>
  
  <ol>
  <li>Split the search string by spaces and search individually for all words in the string</li>
  <li>Order the results descending based on percentage match</li>
  </ol>
  
  <p>For example, in the above scenario, each word in the search string would constitute 33.333% of the total. A <code>NARRATIVE</code> with 3 matches (100%) should be at the top of the results, while a match containing 2 of the keywords (66.666%) would be lower, and a match containing 1 of the keywords (33.333%) would be even lower. </p>
  
  <p>I then want to display the resulting percentage match for that row in a column, along with all the other columns from that table (*).</p>
  
  <p>Hopefully, this makes sense and can be done. Any thoughts on how to proceed? This MUST all be done in SQL Server, and I would prefer not to write any CTEs.</p>
  
  <p>Thank you in advance for any guidance.</p>