Populating data in Date Dimension through SQL server Integration serivces

  • Hi, I have a situation where i need to populate date data starting from 1/1/2000 00:00:00 for the next 10 years. so next record will be 1/2/2000 and so on. for each every record there will be a primary key assigned to it. can you tell me how to do it in SSIS.

  • I'm assuming you need to populate a SQL table with the data?

    If so, you don't necessarily need to use SSIS to do so, you can simply run a SQL script to populate the table.

    Something along the lines of:

    /******************************/

    Create tblDates (dateKey Int Identity(1,1), dateValue datetime)

    Go

    Declare @Date Datetime

    Set @Date = Convert(Datetime, '01-Jan-2000')

    While @Date <= Convert(Datetime, '31-Dec-2009')

    Begin

    Insert tblDates (dateValue)

    Values(@Date)

    Set @Date = Dateadd(Day, 1, @Date)

    End

    Go

    /****************************/

    If you wish, you can embed this code in an Execute SQL task in SSIS.

    HTH,

    Yaniv

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply