Last post May 24, 2018 01:17 AM by Deepak Panchal
May 23, 2018 05:15 PM|aazizasp|LINK
I have a sql table the following columns:
FirstName, LastName, Points, StartTime
I have the data right now with the start time populated for the person with the highest points. StartTime is Null for everyone else.
I want to do the following in a stored procedure.
Populate StartTime with intervals of 30 minutes. So right now there is only one person with StartTime. The next person in line in terms of points gets StartDate 30 minutes after the previous one. There are some conditions. Right now StartDate for the person
with highest points is set to a working day and time is 8:00AM. The next one should be 8:30AM and so on. The last time for a working day is 5:00PM and then it should go to the next working day (skipping weekends) and continue assigning dates and times starting
from 8:00AM to 5:00PM with 30 minutes increment - Only work days until all the StartDates for all the row are populated.
May 24, 2018 01:17 AM|Deepak Panchal|LINK
I try to check your overall requirement and I think that it is better that you perform this operation in your code to increment 30 minutes in next record.
You only want to insert data on working days,
so here you need to create one calendar table.
From where you can find the working day and leaves and enters the data in table based on that.
You can also try to fetch the day from current date to check whether it is working day or not.
But it will not gives you the information about holidays. So in that situation calendrer table can help you.
Then you can simply fire an query from your store procedure to insert the data.