title: How to insert new record and update old one with enddate = new recored startDate - 1?
body: <p>One of the database tables from our ERP system contains only the effictive date for pricing like this :</p>
  
  <pre><code>Partnumber ||Effective Date  || Price
  ----------------------------------------------
  abc             || 2012-01-01    ||  $ 1,00
  abc             || 2012-02-01    ||  $ 1,10   
  xyz             || 2012-01-01    ||  $ 1,00 
  </code></pre>
  
  <p>My Dimension Table looks like :</p>
  
  <pre><code>Partnumber  |Start Date       ||  EndDate        || Price
  -----------------------------------------------------------------
  abc             || 2012-01-01    ||  2012-01-31   ||$ 1,00
  abc             || 2012-02-01    ||  &lt;NULL&gt;        ||$ 1,00
  xyz             || 2012-01-01    ||  &lt;NULL&gt;        ||$ 1,00
  </code></pre>
  
  <p>This enable me find the right price based up the orderdate between StartDate and EndDate (or EndDate IS NULL)</p>
  
  <p>Finaly my question : How can I update the EndDate enddate = new recored startDate - 1 once there are new records for that partnumber with a new EffectiveDate.</p>