I am trying to create a report with Monday the first day of the week, and Sunday the last day of the week.
CONVERT (varchar (10),(DATEADD ( d, 2-DATEPART (dw, Evaluations.Quality_Date), Evaluations.Quality_Date )),111)
What this does is show the week starting on Monday. Usually this was fine, except now I have people working on Sundays, and these days are showing up for the week before.
For example, one week starts on Monday, Jan. 30. My report shows Jan 30th, but when I look at the days that go into that week, it shows Jan. 29 as part of the week of Jan. 30th, instead of being part of the week of Jan 23. Can you help me with this?
This is actually a Microsoft SQL Server code example.
In Oracle, you use the NLS_TERRITORY parameter to set which day the week should start on. You can change it just for your session, e.g.:
ALTER SESSION SET NLS_TERRITORY=German;
Then Monday becomes the first day of the week.
Microsoft has its own method of controlling regional and globalization settings.
Dig Deeper on Oracle and SQL
Related Q&A from Dan Clamage
A reader asks Oracle expert Dan Clamage about a single date condition mucking up a dynamic query. Continue Reading
Expert Dan Clamage explains how to use SQL SELECT and SQL UNION ALL statements to sort and visualize a set of sales figures. Continue Reading
One reader asks expert Daniel Clamage about the PL/SQL to_date and to_char functions and how to properly convert date and string values. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.