title: Fastest string comparison in sql case
body: <p>I have a straight forward <code>SELECT</code> query. Now i need to change values in one column based on another varchar column.</p>
  
  <p>Here an example:</p>
  
  <pre><code>SELECT
    Company_Name,
  
    CASE 
      WHEN Size = 'Large' THEN Company_Name 
      ELSE 'Small company'
    end,
  
    CASE 
      WHEN left (Size,1) = 'L' THEN Company_Name 
      ELSE 'Small company'
    end,
  
    CASE 
      WHEN ASCII(Size) = 76 THEN Company_Name 
      ELSE 'Small company'
    end,
  
    Size
  FROM MyTable
  </code></pre>
  
  <p>Here I have 3 <code>CASE</code>s. Which one is faster? This query is for data extract and it has no <code>WHERE</code> clause.</p>
  
  <p>Thanks a lot!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Q: Why I cannot do it by running against a table?</p>
  
  <p>A:</p>
  
  <ol>
  <li>Running a query on a given dataset does not prove solution is faster for any data set.</li>
  <li>I do not have permissions to reset DB, so test runs are comparable: <code>DBCC DROPCLEANBUFFERS</code></li>
  </ol>