title: SQL CASE and local variables
body: <p>I would like to know how I can use local variables in <code>CASE</code> statements in SQL?</p>
  
  <p>This script gives me an error:  </p>
  
  <pre><code>    DECLARE @Test int;
      DECLARE @Result char(10);
      SET @Test = 10;
  
      CASE @Test
      WHEN @Test = 10
      THEN SET @Result='OK test'
      END
      Print @Result;
  </code></pre>
  
  <p>I use MS SQL 2008.</p>