troubleshooting Question

Search MS SQL DB for available dates

Avatar of Nico2011
Nico2011Flag for United Kingdom of Great Britain and Northern Ireland asked on
ASPMicrosoft SQL Server 2008
3 Comments2 Solutions391 ViewsLast Modified:
Hello Experts,

I'm working on a booking engine and would like to know if anyone knows the best way to search a db for availability.  For example, a customer could search for July 1st 2012 +/-7 days, for a 7 day stay, so the query needs to check that there is no booking, either between the June 24th to July 1st, or June 25th to July 2nd, or June 26th to July 3rd etc., right up to July 7th to July 14th.

My DB at the moment has start and end dates, but I'm simply not sure of the best way to do this...!

Please help!  Thanks :-)
ASKER CERTIFIED SOLUTION
Ephraim Wangoya
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros