Good morning. As suggested by a member of the community, In the post that started this , I have come to ask for collaboration in a logic. I have a table that contains the start-time and dead-time fields. I need a routine that makes it impossible for the user to enter a time range that overlaps with other existing ones, regardless of the day. Any time zone between 24 hours can therefore be entered. Imagine that the table is filled with these values:
inicio termino 1) '07:00:00' - '09:00:00' 2) '09:00:00' - '11:30:00' 3) '12:00:00' - '15:35:00' 4) '22:35:00' - '01:49:00'
The set of parameters below could not be inserted because they overlap the existing schedules.
Não poderia ser inserido: inicio termino 1) '07:00:01' - '08:00:00' 2) '10:00:00' - '11:32:00' 3) '06:00:00' - '23:00:00'
In short, a timetable can not overlap an existing schedule.
I would like to create a SQL statement or a Stored Procedure that would return true or false, telling you whether or not to enter the time range sent by the start and end parameters. The times below could be inserted:
inicio termino 1) '06:00:00' - '06:30:00' 2) '11:30:00' - '12:00:00' 3) '15:35:00' - '16:12:00'
An important note is that you can enter a time range starting at the same time that another one already registered. It can look like this:
inicio termino 1) '06:00:00' - '12:00:00' 2) '12:00:00' - '18:00:00' 3) '18:00:00' - '00:00:00' 4) '00:00:00' - '06:00:00'
Thank you in advance for your support.