Click here to Skip to main content
15,887,975 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
To explain it in a better way, Lets us suppose there is on call staff set and those staff members will rotate after X days or X weeks. Now instead of creating repetitive entries in the calendar is it possible to create "recurrence events" similar to outlook. If its possible then how can that be achieved

What I have tried:

I am not sure how it can be done.
Posted
Updated 20-Nov-18 4:27am
Comments
CHill60 20-Nov-18 5:53am    
A "recurrence" event is still a set of "repetitive entries" in Outlook - you can manage them as a set or as individual items. But there is nowhere near enough information here for us to even start to help you

Create a stored proc that implements the business rules.

Above and beyond that, you didn't specify anything resembling what you want.
 
Share this answer
 
I'll do a very simple proof of concept for you, as you gave us zero to work with.
This should give you a place to start... you could replicate the SP as needed for doing different interval based inserts, just change your naming and the interval type as needed.

First I'm doing a very simple table to hold your data. It needs more than this... but I have no clue what your needs are
SQL
CREATE TABLE EmployeeSchedule (
	ScheduleID INT IDENTITY(1,1) NOT NULL,
	EmployeeID INT,
	ScheduleDate DATE
)
GO

And then a simple stored procedure to insert a series of dates
SQL
CREATE PROCEDURE dbo.EmployeeSchedule_Insert_WeeklyReoccurence (
	@EmployeeID INT,
	@StartDate DATE,
	@EndDate DATE,
	@WeekInterval INT
) AS
BEGIN
	DECLARE @ScheduleDate DATE = @StartDate

	WHILE (@ScheduleDate <= @EndDate) BEGIN

		INSERT EmployeeSchedule (EmployeeID, ScheduleDate)
		VALUES (@EmployeeID, @ScheduleDate)

		SET @ScheduleDate = DATEADD(wk, @WeekInterval, @ScheduleDate)
	END
END
GO
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900