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 development languages
Related Q&A from Dan Clamage
Oracle PL-SQL expert Daniel Clamage answers a question about a problem with doing an “insert” in PL-SQL to create a table dynamically. Continue Reading
Are you seeing an invalid identifier? Learn when to use double quotes in Oracle column names to avoid this in this tip from PL/SQL expert Dan Clamage. Continue Reading
PL/SQL expert Dan Clamage explains how to concatenate rows into a single CLOB in PL/SQL. Continue Reading