title: using IF in a SQL Server View
body: <p>I have a view in SQL server that translates from one schema version to another.<br>
  Currently, the view looks like this:</p>
  
  <pre><code>SELECT newValue AS oldValue  
  FROM dbo.MyTable
  </code></pre>
  
  <p>The trouble is that, in the new schema, newValue is not nullable, so we set it to -1 to denote empty fields, but in the old schema, it was nullable.</p>
  
  <p>How can I do something to the effect of:</p>
  
  <pre><code>SELECT  
  (  
    IF( newValue &gt; -1 )  
      newValue as oldValue  
    ELSE  
      NULL as oldValue
  )  
  FROM dbo.MyTable
  </code></pre>