I am trying to figure out how to apply a unique constraint based on weeks in a quarter.
I have a table that includes Quarter
(1Q2014, 2Q2014, ...) as well as an Effective Date
and an Expiration date
.
I need to allow multiple records for the same Qtr
as long as Effective
and Expiration Dates
do not overlap.
For example, these records would be legitimate:
Qtr EffDte ExpDte
--------------------------------------
1Q2014 2014-01-06 2014-02-03
1Q2014 2014-02-10 2014-02-24
1Q2014 2014-03-03 2014-03-17
While these records would not be legitimate:
Qtr EffDte ExpDte
--------------------------------------
1Q2014 2014-01-06 2014-03-24
1Q2014 2014-02-10 2014-03-10
1Q2014 2014-03-03 2014-03-17
I am not sure if I need to alter my table design to achieve this goal.
Does anyone have any suggestions?