I have a pretty simple table that stores a
StartTime and an
EndTime, both with the data type of
Time(0). I need to enforce a constraint that prevents any overlapping. 'Touching' time periods are OK, like 2pm-3pm and 3pm-4pm. I have created a function to use for the constraint but I am having a hard time dealing with time periods that span the midnight hour. Any help would be appreciated!
This is driving which hours that a product is available every day. So unfortunately I can not attach an exact date to these time periods.
If the product is always available, the StartTime and EndTime would be the same (i.e. 00:00:00 and 00:00:00). I know this is probably bad design.
The active periods are just for a 24 hour window.
The requirement for EndTime to be greater than StartTime was removed (phew!). I have accepted the answer below, thank you!