Finishing the Population of a Date Dimension


  • So the client has a date dimension in SQL Server (not SSAS) that only goes to 2022.  They want the data to go to 2028 at least.  What is an efficient way to add the additional 6 years of data?  
    venerdì 23 marzo 2018 17:50

Tutte le risposte

  • You could write some SQL. For example

    insert into dbo.MyDates (TheDate)
    select DATEADD(dd,2190,TheDate) --365*6=2190
    from dbo.MyDates
    where DATEADD(dd,2190,TheDate)
    not in (select TheDate from dbo.MyDates)

    This assumes that you already have 6 years, but you can tweak the query to use any range you like and put an upper limit etc.

    Hope that helps,


    mercoledì 28 marzo 2018 23:37