我们目前在仓库中有这个日期视图:
ALTER VIEW [dbo].[vw_DimDate] AS
SELECT
D.DateKey
, D.DayMarker AS DayMarker
, D.Year_YYYY as CalendarYear
, D.Quarter_QQ as QuarterName
, D.Quarter_QQ + ' - ' + D.Year_YYYY AS CalendarQuarterName
, D.Month_MMM as MonthShortName
, D.Month_MMMM as MonthName
, D.Month_MMMM + ' ' + D.Year_YYYY AS CalendarMonthName
, D.Week_WW as WeekName
, D.Week_WW + ' - ' + D.Year_YYYY AS CalendarWeekName
, D.Day_DD + ' ' + D.Month_MMMM + ' ' + D.Year_YYYY AS CalendarDayName
, D.DayOfWeekName
,convert(datetime,'01 ' + Month_MMM + ' ' + D.Year_YYYY) as FirstDayOfMonth
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<as LastDayOfMonth
, W.WeekYear_YYYY as Week_Year
, W.Week_WW + ' ' + W.WeekYear_YYYY as Week_YearWeekName
FROM
WHData..TB_DimDate D
JOIN
WHData..tb_DimDateWeek W
on D.DateKey = W.DateKey
where
D.DateKey < convert(char(8),getdate(),112)
我想添加一个字段LastDayOfMonth
- 这个的标准实现是什么?