Q
Problem solve Get help with specific problems with your technologies, process and projects.

Making Monday the start of the week in Oracle SQL

One reader asks how to set up a report in Oracle SQL so that Monday is the first day of the week.

More on Oracle and SQL

Read other expert SQL answers from Dan Clamage

Ask your own SQL question

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.

This was last published in February 2012

Dig Deeper on Oracle and SQL

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

  • How do I size a UPS unit?

    Your data center UPS sizing needs are dependent on a variety of factors. Develop configurations and determine the estimated UPS ...

  • How to enhance FTP server security

    If you still use FTP servers in your organization, use IP address whitelists, login restrictions and data encryption -- and just ...

  • 3 ways to approach cloud bursting

    With different cloud bursting techniques and tools from Amazon, Zerto, VMware and Oracle, admins can bolster cloud connections ...

SearchContentManagement

SearchHRSoftware

Close