title: SQL - string comparison ignores space
body: <p>This query:</p>
  
  <pre><code>SELECT CASE WHEN 'abc ' = 'abc' THEN 1 ELSE 0 END
  </code></pre>
  
  <p>Returns 1, even though 'abc ' clearly is not equal to 'abc'. Similarly,</p>
  
  <pre><code>SELECT CASE WHEN 'abc ' LIKE '%c' THEN 1 ELSE 0 END
  </code></pre>
  
  <p>Also returns 1. However, a very similar query:</p>
  
  <pre><code>SELECT * FROM #tempTable WHERE Name LIKE '%c' 
  </code></pre>
  
  <p>Did not return a row where Name = 'abc '.</p>
  
  <p>SQL Server 2008 R2, Windows 7 &amp; 2008 R2, x64.</p>