title: SQL CASE Statement Versus Conditional Statements In Programming Language
body: <p>I'm going through some old stored procedures at work and constantly come across</p>
  
  <pre><code>CASE MyColumn WHEN 'Y' THEN 'Yes' WHEN 'N' THEN 'No' ELSE 'Unknown' END
  </code></pre>
  
  <p>It gets even worse when this is tied not to a word, but instead a colour.</p>
  
  <pre><code>CASE MyColumn WHEN 'Y' THEN 'style="background-color:pink"' ELSE '' END
  </code></pre>
  
  <p>The reason this was done was for older ASP 1 pages where everything had to be done inline, but as it's such a large system it's impossible to keep up with updating all the pages.</p>
  
  <p>Can anyone give any valid evidence that using a SQL query for conditional statements surpasses that in other languages such as C# or Java?  Is this good practice for speed?  Should the plain value be returned and the presentation layer decide what should be done?</p>