General discussion

Locked

SQL Server 2000-Compensate For Weekends

By bgibilaro ·
Here is my problem:
I have a date: date1 I want my page to show an alert when today's date is 1 day after date1, along with some other parameters. I am using a SQL Server 2000 view to accomplish all of the filtering on the backend since there are going to be multiple instances like this on my web page, thus the overhead is too large for ASP.

I need my SQL query(View) to compensate for weekends. In other words if date1 is a Friday, I don't want the alert on Saturday, I want it to wait until Monday to alert me. Is there some sort of Aggregate or Scalar function in SQL that I can use to take care of this problem in my query? Or, does anyone have a better idea how to solve this problem. Thanks for your help.

Bob Gibilaro, Web Developer, V. Alexander & Co., Inc.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

SQL Server 2000-Compensate For Weekends

by Bojidar Alexandrov In reply to SQL Server 2000-Compensat ...

/* Here is an example to do this */
use pubs

Select stor_id, ord_date, DateName(weekday,ord_date) as Day_of_ord_date,
alert_date =
CASE
WHEN DateName(weekday,ord_date)='Friday' THEN DateAdd(day,3,ord_date)
WHEN DateName(weekday,ord_date)='Saturday' THEN DateAdd(day,2,ord_date)
ELSE DateAdd(day,1,ord_date)
END
From sales

Collapse -

SQL Server 2000-Compensate For Weekends

by bgibilaro In reply to SQL Server 2000-Compensat ...

Poster rated this answer

Collapse -

SQL Server 2000-Compensate For Weekends

by bgibilaro In reply to SQL Server 2000-Compensat ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums