I'm afraid I will not compromise!
Thus I don't suppose this SP is possible in LLBLGen?
ALTER PROCEDURE sp_Theatres#GetValidTheatreShowMonth
@theatreID int
AS
DECLARE @timeSpans TABLE
(
spanStart DATETIME,
spanEnd DATETIME
)
DECLARE @nextMonth DATETIME, @today DATETIME
SET @today = CONVERT(varchar(10), GetDate(), 101)
SET @nextMonth = DATEADD(Month, 1, @today)
SET @nextMonth = DATEADD(day, -(DATEPART(day, @nextMonth) - 1), @nextMonth)
INSERT INTO @timeSpans VALUES ( @today, @nextMonth )
INSERT INTO @timeSpans VALUES ( @nextMonth, DATEADD(Month, 1, @nextMonth) )
INSERT INTO @timeSpans VALUES ( DATEADD(Month, 1, @nextMonth), DATEADD(Month, 2, @nextMonth) )
INSERT INTO @timeSpans VALUES ( DATEADD(Month, 2, @nextMonth), DATEADD(Month, 3, @nextMonth) )
SELECT
DATENAME(m, spanStart) AS 'MonthName', DATEPART(month, spanStart) AS 'MonthID', DATEPART(year, spanStart) AS 'Year'
FROM
@timeSpans
WHERE
EXISTS (
SELECT
showID
FROM
tbl_show_theatre
WHERE
startDate <= spanEnd
AND
endDate >= spanStart
AND
theatreID = @theatreID
)
ORDER BY
Year, MonthID