title: SQL Case statement
body: <pre><code>SELECT MIN(Measurement),     
         (CASE 'NonDesMin'
            WHEN len(measurement) = 6 then '0000'
            ELSE '000'
          END) as [Min]    
    FROM LeachingView 
   WHERE DateTimeStamp &gt; '2011-01-01' 
     AND measurement &gt; 0 
  </code></pre>
  
  <p>This is my SQL statement. I want to check the length of the field measurement, and if it is 6 characters long i want to display four 0's, else three 0's. i can getting an error:</p>
  
  <blockquote>
    <p>incorrect syntax near '='.</p>
  </blockquote>