date range question

Hello all,

I have an MS SQL 2K DB with a date feild.  (Tracks events that are going to happen for that week, M-F)

On a web page, I want to be able to display all the records that take place that week, none before or after.  The web page will be viewed everyday, so it will always need to go back to the beginning of the week, monday - and display records for that day, through the friday at the end of the week.  Then of course, the following monday, the web page can't show any of the records from the previous week, only the records for the business week you're currently in the middle of.

I hope I've explained it well, I'll specify if anyone has questions.

Thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rush_2112Author Commented:
points increased**
Use this code to determine the start date for your date range (which will always be a Monday):
<CFSET date = dateformat(now(),'m/d/yy')>
<CFSET displaydate = dateadd("d",-dayofweek(date-1)+1,date)>

Now, in your query grab all records where the dates are greater than displaydate and less than the displaydate + 5 days (through Friday). Although I would add 7 days to show any events on the weekend. But you can do whatever you want.
FROM ...
WHERE datefield >= #displaydate#
AND datefield < #dateadd("d",5,displaydate)#

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rush_2112Author Commented:

This works perfectly!! Thank you!!

(This will still pull all of Mon-Fri data, even on a tuesday - right?)  In other words, it will still pull from dates that have past if it's in this week, correct?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.