title: SQL Server : Computed Column DATEDIFF Clause
body: <p>What I'm trying to do is the following: I have 3 columns (<code>Control_OpenDate</code>, <code>Control_Record Age</code>, <code>Control_Stage2</code>). Once the row is inserted it will populate <code>Control_OpenDate</code> (01/27/2013) and <code>Control_RecordAge</code> (computed column, see formula).</p>
  
  <pre><code>(datediff(day, [Control_OpenDate], getdate()))
  </code></pre>
  
  <p>which gives the days up to date.</p>
  
  <p>Everything is working perfect but I want to add like an <code>IF</code> condition to the computed column whenever the column <code>Control_Stage2</code> is populated if not, do not calculate or add a text... </p>
  
  <p><em>How can I add the <code>WHERE</code>-statement in the above formula??</em></p>
  
  <p>Note: I'm entering such formula directly into the column properties, I know there are queries that can do this but is there a way to do it trough a formula.</p>