Assuming weeknumber is required, the following 6 results were found.
DECLARE @GivenDate datetime, @GivenCampus varchar(100), @setId varchar(10), @weekNumber int, @siteId nvarchar(5), @baseDate datetime, @specifiedDate datetime, @specifiedCampus varchar(25) SET DATEFORMAT dmy --SET @GivenDate = '1/7/2011' --SET...
T-SQL Record Separatorhttps://joellipman.com/articles/database/t-sql/t-sql-record-separator.html
'Day', dateadd(d, tt.[WeekDay] - 1, (SELECT TOP 1 StartDate FROM [pretendDatabase].[pretendSchema].[WEEKSTRUCTURE] WHERE WeekNumber=wm.[WeekNumber])) AS 'Date', tt.[RoomId] AS 'Room', tt.[StartTime] AS 'Start', tt.[FinishTime] AS 'Finish', sd.[Descrip]...
us assume that we have a system holding a calendar in the following table (called "joes_weekstructure"): ID AcademicSet WeekNumber StartDate --------- ----------------- --------------- ------------------ 417 2012/2013 1 2012-07-16 418 2012/2013 2...
and wm.[WeekId] = tt.[WeekId]) WHERE 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%' --Cycle through all...
are academic week numbers. So I can't use the built-in functions. The current structure looks similar to this: ID SetID WeekNumber StartDate --------- ---------------- ---------------------- ---------------------------- 1 2011/2012 1 2011-07-18 00:00:00...
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...