


When i run this query ,at the end of the 2013 it gives the result as,įor dates 29 ,30,31st it should give 53. This query gives date, weekday and week_num for 2 years 20, To_char(next_day(mydate,'sunday'),'iw') as week_numįROM ( SELECT TRUNC (SYSDATE, 'yy') - 1 + LEVEL AS mydateĬONNECT BY LEVEL <= (SELECT TRUNC (ADD_MONTHS (SYSDATE, 24), 'yy') DECLARE date date '' SELECT DATEPART(week, date. To return the week number, use week as the first argument of the DATEPART() function. By week number I mean the week’s number within the year of the specified date. I have a query that starts with 01 when year starts but it gives problem in the end of the year. You can use the T-SQL function DATEPART() to return the week number from a date in SQL Server. How can i achieve this, can anyone please help me out on this. again in the next year it should start with '01'. in the end date of the year it should not be 'saturday' but week number should end with last date of the year. so next week number starts with sunday and ends with saturday ,continously. So that week number should start with 01 when the year starts and it should end with week end date(that is first saturday of the january month). I have the requirement to find the week number for the calender. 1.7K Training / Learning / Certification.Other notes Monday is starting date and Sunday is Week ending date. Here is the Criteria below: I'm trying to go back 52 weeks based on (today's date). 165.3K Java EE (Java Enterprise Edition) How do I write this SQl statement for below.7.9K Oracle Database Express Edition (XE).3.8K Java and JavaScript in the Database Using Oracle SQL, how do you create a result set for: Number for the Day Of The Week (1-7) Name of the day (Monday, Tuesday, Wednesday, etc.
