title: conditions in Case statement
body: <pre><code>select min(measurement), part_desc
      (case len(measurement)
          when 6 then '0000' + part_desc
          else '000' + part_desc
          end)
  from LeachingView
  where DateTimeStamp &gt; '2011-01-01' and measurement &gt; 0
  group by measurement, part_desc
  </code></pre>
  
  <p>That is suppposed to append 0000's to the front of another char, but it doesn't work, and i was wondering why and how to make it correct.</p>
  
  <p>The error I get is this:</p>
  
  <blockquote>
    <p>'part_desc' is not a recognized built-in function name.</p>
  </blockquote>