title: sql server case - dates
body: <p>I have the following table:</p>
  
  <pre><code>ID   ActualDt   DueDt     Flag
  --   -------    -------   ----    
  1    01/03/12   09/13/12   Y
  2    NULL       07/12/12   Y 
  3    NULL       09/12/12   N
  4    02/03/12   01/13/12   N
  </code></pre>
  
  <p>I need to mark Flag as Y for the following conditions:</p>
  
  <p>1) If ActualDt is not null and DueDt is not null and DueDt > ActualDt</p>
  
  <p>2) If ActualDt is null and DueDt is past due based on current date</p>
  
  <p>Otherwise, Flag = N</p>
  
  <p>Note that ActualDt is a string</p>
  
  <p>How would I program this in t-sql</p>
  
  <p>I know I need a case statement.</p>