Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Recurring booking

Author  Topic 

Petehe
Starting Member

20 Posts

Posted - 2004-06-09 : 01:00:42
Hi all,

I am working on a vehicle booking system.
But the requirement is we need to make it work with recurring bookings (such as the car will be booked out every Monday morning).

Can anyone give me some idea how to design database to cope with this?

Your help is much appreciated.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-09 : 01:22:50
Have a table of vehicles:
VehicleID
VehicleType
VehicleRego

Have a table of Recurring bookings:
RecBookID
VehicleID
Frequency (ie weekly daily)
StartTime
EndTime
StartDate
EndDate

Make a table of regular bookings
BookingID
VehicleID
StartBooking
EndBooking

Then to bring them together, have create a stored procedure to give you a list of all bookings over a given period.

Should do the trick.

Tim
Go to Top of Page

Petehe
Starting Member

20 Posts

Posted - 2004-06-09 : 01:40:33
Thanks for your help, can you give me a bit more details for stored procedure.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2004-06-09 : 02:26:56
This comes up occasionally.
The only problem with Tim's example is if you wish to change one instance of an appointment. I.E. If the car is NOT booked out on a particular monday.

Here is a good thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=10761&SearchTerms=recurring

Another option is to look at the sysjobschedules table in the MSDB database to see how SQL Server jobs are handled.


Damian
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-06-09 : 02:42:21
Thanks Damian -

I also didn't realise how much of a bastard the SP was going to be to write and debug......

Tim
Go to Top of Page
   

- Advertisement -