I have a problem I don't know if I can do it in the SQL server. I have an "Appointment" table that contains Name, StartDateTime and StopDateTime. Each row represents one appointment. When I want to schedule a new appointment, I want to find the next N available time slot. I think this is too complex to write in an sql statement. Is it possible to write a stored prod?
The function has a few parameters:
- DateTimeToStartSearching (e.g. I want to start searching today)
- NumberOfMinutesForNewAppointment (new appointment requires 30 minutes)
- NumberOfAvailableTimeSlotsToReturn (wants 10 options to be returned)
- EarliestTime (e.g. we want the appointment to be in the afternoon, then EarliestTime is 1pm and LatestTime is say 5pm.
- LatestTime
The function has a few parameters:
- DateTimeToStartSearching (e.g. I want to start searching today)
- NumberOfMinutesForNewAppointment (new appointment requires 30 minutes)
- NumberOfAvailableTimeSlotsToReturn (wants 10 options to be returned)
- EarliestTime (e.g. we want the appointment to be in the afternoon, then EarliestTime is 1pm and LatestTime is say 5pm.
- LatestTime