title: Find Top 1 best matching string in SQL server
body: <p>I have a table '<strong>MyTable</strong>' which has some business logics. This table has a column called <strong>Expression</strong> which has a string built using other columns. 
  My query is </p>
  
  <pre><code>Select Value from MyTable where @Parameters_Built like Expression
  </code></pre>
  
  <p>The variable @Parameters_Built is built from Input parameters by Concatenating all together.</p>
  
  <p>In my current scenario,</p>
  
  <pre><code>@Parameteres_Built='1|2|Computer IT/Game Design &amp;amp; Dev (BS)|0|1011A|1|0|'
  
  Below are the expressions
  ---------------------
  %%|%%|%%|0|%%|%%|0|
  ---------------------
  1|2|%%|0|%%|%%|0|
  ---------------------
  1|%%|%%|0|%%|%%|0|
  ---------------------
  </code></pre>
  
  <p>So my above query returns true for all the three rows. But It should return only the second row (Maximum match). </p>
  
  <p>I just don't need a solution with fix for this scenario. It's just a example. I need a solution like choosing the best match. Any idea?</p>