Solved

Query Sensitive To Day Of Week

Posted on 2011-09-19
2
305 Views
Last Modified: 2013-11-05
I need to add a second line to the WHERE clause that looks at GetDate() and does not return records if it Friday, Saturday or Sunday

SELECT Account
FROM Accounts
WHERE
DateDiff(day, Accounts.SubmissionDate, getdate()) >= 15 AND
getdate() IS NOT ON Friday, Saturday or Sunday

0
Comment
Question by:PhilChapmanJr
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 36562617
Please try:

SELECT Account
FROM Accounts
WHERE
DateDiff(day, Accounts.SubmissionDate, getdate()) >= 15 AND
DATENAME(dw, getdate()) NOT IN  ('Friday', 'Saturday', 'Sunday')
0
 
LVL 2

Author Closing Comment

by:PhilChapmanJr
ID: 36562650
Perfect!!
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now