none
Finishing the Population of a Date Dimension

    Question

  • 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?  
    Friday, March 23, 2018 5:50 PM

All replies

  • 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,


    Richard

    Wednesday, March 28, 2018 11:37 PM