I have two datasets. One is a dimension table with data similar to the below sample
Table1
Key StartDate EndDate Name Data_1
1 2017-01-01 2017-01-03 Billy G 58uf
2 2017-01-10 2017-01-12 S Dogg 4940
I also have a standard Date Dimension called dbo.DimDate. How can I Merge the date dimension onto the Table1 so that Table1 contains a record for each day between StartDate and EndDate for each record?
The desired result is something like this:
Table2
Key StartDate EndDate Name Data_1 Day
1 2017-01-01 2017-01-03 Billy G 58uf 2017-01-01
1 2017-01-01 2017-01-03 Billy G 58uf 2017-01-02
1 2017-01-01 2017-01-03 Billy G 58uf 2017-01-03
2 2017-01-10 2017-01-12 S Dogg 4940 2017-01-10
2 2017-01-10 2017-01-12 S Dogg 4940 2017-01-11
2 2017-01-10 2017-01-12 S Dogg 4940 2017-01-12
This needs to be accomplished in an SSIS package. I don't think a simple MERGE JOIN will work because 1) The Date dimension does not have a key that matches anything in Table1, and 2) I need it to add a Day for every date BETWEEN StartDate and EndDate
If I do an execute SQL Command, then how do I get it to pull from two separate tables?