Re: Excluding weekend dates from calculated data pull
- From: Wells, Carrie E <WellsCarrieE@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 May 2005 05:08:02 -0700
Since the site is 24/7 then that should be ok. The whole reason for 3 days
was to work around the schedules of our foriegn customers, who of course
don't have the same holidays. This issue was about certian Key Customers
getting the data first but not before the company rules said they could.
Thanks for the solution. I never even thought about using a Case statement
and this has been driving me crazy for two weeks. :-)
Thanks Again,
Carrie Wells
--
Carrie E. Wells
Web Architect/Developer
"Hugo Kornelis" wrote:
> On Wed, 25 May 2005 08:43:25 -0700, Wells wrote:
>
> (snip)
> >What I need to know is if there is a way in the SQL Query to not count the
> >weekend days as part of the 3 bussiness days. My query right now uses "WHERE
> >datafield < (GetDate + 5)". But this lets the users see data for the week's
> >Friday on the week's Monday. Not acceptable. If I only use "WHERE datafield <
> >(GetDate + 3) Then data to been displayed on This week's Tuesday can not be
> >seen on the previous Friday. Also Not Acceptable.
>
> Hi Carrie,
>
> The simple, quick and dirty solution would be to use a CASE expression
> to add either 3 or 5 to the current date, depending on the result of
> DATEPART(day, GetDate()). But that would not take public holidays and
> company holidays into account.
>
> The best solution is to use a calendar table. You'll have to create it
> once; after that, you can use it in this and many other situations. How
> to make a calendar table, and many possible usees, is described at this
> site: http://www.aspfaq.com/show.asp?id=2519
>
>
> >Oh, and if Ihave this posted int eh wrong place tell me where to put it an I
> >move it.
>
> I don't think you can move posts on Usenet :-)
>
> Anyway, this group is actually intended for MSEQ (Microsoft English
> Query). In practice, nobody ever posts anything about MSEQ, but the
> group does catch some stray questions about SQL Server queries.
>
> A better place for this kind of questions is the programming group at
> microsoft.public.sqlserver.programming. That group is frequented by many
> more experts than this one.
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
.
- References:
- Excluding weekend dates from calculated data pull
- From: Wells, Carrie E
- Re: Excluding weekend dates from calculated data pull
- From: Hugo Kornelis
- Excluding weekend dates from calculated data pull
- Prev by Date: Re: A tree of location and site names..
- Next by Date: Re: RUSSIAN SQL PROBLEM
- Previous by thread: Re: Excluding weekend dates from calculated data pull
- Next by thread: Keyword syntax error
- Index(es):