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?  
    vendredi 23 mars 2018 17:50

Toutes les réponses

  • 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

    mercredi 28 mars 2018 23:37