sql - Storing Schedule Information -
i need create table hold schedule meetings. meeting can scheduled be:
daily 'ever x days'. x can between 1 , 6. ending after x sessions. 'sessions' number of repeats.
weekly days during week can occur. mon, tue, etc. can select more 1 day per week. date on ends.
monthly use can select day of month can occur (1st, 2nd etc) or can select lookup of '1st, 2nd, 3rd, 4th or last' , day 'mon, tues', saying, example "the 2nd friday" of month.
how can store these scenarios in single table?
i thinking:
create table schedule ( id int not null identity(1,1) primary key, startdate datetime not null, endtime time null, repeattypeid int not null, // daily, weekly, monthly, none // daily everydaycount int null, // handle 'every 3 days', repeatcount int null, // how many occurances. can shared different repeattypes // weekly ismonday bit, istuesday bit, etc // field per day selection. there better way? // monthly monthlydaynumber int null, monthlyrepeatintervalid int, // lookup table '1st, 2nd, 3rd, 4th, last' monthlydayrepeatselection int // lookup on monday, tuesday etc )
but seems inefficient. there better design pattern these sorts of requirements?
even though have daily, weekly, monthly etc... still means meeting occur on specific day ... right ?
thus
create table schedule ( id int not null identity(1,1) primary key, startdate datetime not null, enddate datetime not null, repeattypeid int not null, // daily, weekly, monthly, none repeatcount int not null, dayon int not null, // can calculated field based on start date using day function )
i believe can capture schedule options.
Comments
Post a Comment