... // returns 2020
You should also pad single digit week numbers if we're going to store a year week value:
v_ThisCurrentWeekNumber = if(zoho.currentdate.toString("u").toLong() == 7,zoho.currentdate.subDay(1),zoho.currentdate).toString("w");
v_ThisCurrentWeekNumberPadde ...
... This has to be a label to the name of the column enclosed between square brackets or double-quotes:
Before:
SELECT
calendar.WeekNumber AS [Academic Week],
calendar.Monday,
calendar.Tuesday,
calendar.Wednesday,
calendar.Thursday,
calendar.Friday
FROM
calendar
-- ...
... WHERE WeekNumber=wm.[WeekNumber])) AS 'Date',
tt.[RoomId] AS 'Room',
tt.[StartTime] AS 'Start',
tt.[FinishTime] AS 'Finish',
sd.[Descrip] AS 'Event Type',
sd.[Notes] AS 'Booking Notes',
c.[Name] ...
... to normal people's week numbers is because these are academic week numbers. So I can't use the built-in functions.
The current structure looks similar to this:
ID SetID WeekNumber ...
... sd.[SetId] = @setId
AND dateadd(d, tt.[WeekDay] - 1, @baseDate) = @GivenDate
AND wm.[WeekNumber] = @weekNumber
AND tt.[SiteId] = @siteId
AND upper(sd.[Descrip]) not like 'ADDITIONAL TIMETABLE%'
...
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies. Read more about our Privacy Policy.