title: T-SQL CASE Clause: How to specify WHEN NULL
body: <p>I wrote a T-SQL Statement similar like this (the original one looks different but I want to give an easy example here):</p>
  
  <pre><code>SELECT first_name + 
      CASE last_name WHEN null THEN 'Max' ELSE 'Peter' END AS Name
  FROM dbo.person
  </code></pre>
  
  <p>This Statement does not have any syntax errors but the case-clause always chooses the ELSE-part - also if the last_name is null. But Why?</p>
  
  <p>What I want to do is to unite first_name and last_name, but if last_name is null the whole name becomes null:</p>
  
  <pre><code>SELECT first_name +
     CASE last_name WHEN null THEN '' ELSE ' ' + last_name END AS Name 
  FROM dbo.person
  </code></pre>
  
  <p>Do you know where the problem is?</p>