Click here to Skip to main content
14,451,447 members
Rate this:
Please Sign up or sign in to vote.
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.
Updated 20-Nov-18 5:27am
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

Create a stored proc that implements the business rules.

Above and beyond that, you didn't specify anything resembling what you want.
Rate this:
Please Sign up or sign in to vote.

Solution 2

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
CREATE TABLE EmployeeSchedule (
	EmployeeID INT,
	ScheduleDate DATE

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

	WHILE (@ScheduleDate <= @EndDate) BEGIN

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

		SET @ScheduleDate = DATEADD(wk, @WeekInterval, @ScheduleDate)

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100