Wow, very cool, thanks. I'll review it and get back with any follow-up questions or comments. Thank you for your expertise and time.
Regards,
Phil
Main Topics
Browse All TopicsWe have a (poorly written) application scheduling feature in our application that is presenting some interesting issues. A resource's availability is persisted in our database as follows:
Date | Availability
11/30/2008 | XXXXXXXXXXXXXXXXXXXXAAAAAA
12/01/2008 | XXXXXXXXXXXXXXXXXXXXXXXXXX
12/04/2008 | XXXXXXXXXXXXXXXXXXXXXXXXXX
.... etc.
There's an ID field so we know which resource the "Availability" string applies to. Here's the basic thought process behind how this thing works:
-- Each resource has an availability string on dates when he / she is available. If no record is found for a resource on a given date, the resource is not available at all that day
-- The "Availability" string is 96 characters, each representing a 15-minute increment of the day. Accordingly, the first character shows the resource's availability between 00:00 and 00:15, and the last character shows the resource's availability between 23:45 and 00:00 of the following day.
I'm looking for a way to quickly / efficiently be able to select resources that are available for a given date or date range at a given time or time range. For example, "Show me all resources available between 6:00 AM and 8:00 AM for the week of 12/13 through 12/20."
Obviously, this very strange way of persisting availability makes this quite a challenge.
I'm looking for efficient, creative ways to solve that problem -- high level ideas or concepts are welcome... Not necessarily looking for someone to do all the work for me -- just to recommend some ideas that I may not have thought of.
The application is classic ASP, so I could do this using ASP after the availability strings are found for the requested date range(s), but I'm thinking that perhaps there's a better way to do this using T-SQL ?
Thank you in advance for any assistance.
Regards,
Phil / peh803
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: adamsjsPosted on 2008-12-06 at 13:15:08ID: 23113659
Using a tally table might help here. It provides a quick way to parse the Availability value. I've attached some code that shows some basic samples that will find a staff member available some time between two specified date/time values.
l.com/arti cles/TSQL/ 62867/
See this article on SQLServerCentral.com for more information about using a tally table: http://www.sqlservercentra
They don't take into account where the staff member is also unavaible for a portion of the time period specified (i.e., they are available sometime between between 8 a.m. and 5 p.m., but also unavailable from 1 p.m. to 2 p.m. in that range). But you can use this info to build upon. I've also attached a file with the same code.
Hope this is helpful.
Select allOpen in new window
Sample of parsing Availability string