Search code examples
sql-server-2008ssas

Where to get vDateFeed view definition for SSAS Labs?


I have download and installed the Adventure Works database to use with the SSAS labs and videos.

However they all seem to make use of a view called vDateFeed that is non existent in the datasource and setup files. So that basically puts an end to using the tutorials. There doesn't seem to be anywhere to download this view definition.

Does anyone have it and if so can you please post it here?


Solution

  • I just went into the virtual lab. If you want a shortcut, the view is defined as

    CREATE VIEW [dbo].[vDateFeed]
    AS
        SELECT
            [DateKey],
            [FullDateAlternateKey] AS [Date],
            CAST([CalendarYear] AS NCHAR(4)) + N' ' + LEFT([EnglishMonthName], 3) + N', ' + CASE WHEN [DayNumberOfMonth] < 10 THEN N'0' ELSE N'' END + CAST([DayNumberOfMonth] AS NVARCHAR(2)) AS [DateLabel],
            (([CalendarYear] * 100) + [MonthNumberOfYear]) AS [MonthKey],
            CAST([CalendarYear] AS NCHAR(4)) + N' ' + LEFT([EnglishMonthName], 3) AS [MonthLabel],
            [MonthNumberOfYear] AS [MonthOfYearKey],
            LEFT([EnglishMonthName], 3) AS [MonthOfYearLabel],
            (([CalendarYear] * 10) + [CalendarQuarter]) AS [CalendarQuarterKey],
            N'CY' + CAST([CalendarYear] AS NCHAR(4)) + N' Q' + CAST([CalendarQuarter] AS NCHAR(1)) AS [CalendarQuarterLabel],
            [CalendarQuarter] AS [CalendarQuarterOfYearKey],
            N'CY Q' + CAST([CalendarQuarter] AS NCHAR(1)) AS [CalendarQuarterOfYearLabel],
            [CalendarYear] AS [CalendarYearKey],
            N'CY' + CAST([CalendarYear] AS NCHAR(4)) AS [CalendarYearLabel]
        FROM
            [dbo].[DimDate];
    GO