One of the database tables from our ERP system contains only the effictive date for pricing like this :
Partnumber ||Effective Date || Price
----------------------------------------------
abc || 2012-01-01 || $ 1,00
abc || 2012-02-01 || $ 1,10
xyz || 2012-01-01 || $ 1,00
My Dimension Table looks like :
Partnumber |Start Date || EndDate || Price
-----------------------------------------------------------------
abc || 2012-01-01 || 2012-01-31 ||$ 1,00
abc || 2012-02-01 || <NULL> ||$ 1,00
xyz || 2012-01-01 || <NULL> ||$ 1,00
This enable me find the right price based up the orderdate between StartDate and EndDate (or EndDate IS NULL)
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.