[英]SSIS Lookup multiple dates in my fact table, how to pull this off using one date dimension?
In my SSIS/DW project, I have a DIM.DATE dimension which is linked to my FACT table by a surrogate key as follows: 在我的SSIS / DW项目中,我有一个DIM.DATE维度,该维度通过代理键链接到我的FACT表,如下所示:
ALTER TABLE FACT.SALES ADD date_id INT NOT NULL
ALTER TABLE FACT.SALES WITH CHECK ADD CONSTRAINT FK_dim_date FOREIGN KEY (date_id) REFERENCES DIM.DATE(date_id)
This creates a "date_id" in my fact table, now during my SSIS import process I have a date column being passed (shipped_date), I use this to look up the DIM.DATE table and pass in the surrogate key in my dimension. 这将在我的事实表中创建一个“ date_id”,现在在我的SSIS导入过程中,我传递了一个date列(shipped_date),我用它来查找DIM.DATE表并在维中传递代理键。
This works great, but now I need to have a few different date dimensions for invoice date, received date, etc. 这很好用,但是现在我需要为发票日期,接收日期等设置一些不同的日期尺寸。
I am confused as to how to make use of the existing DIM.DATE to do this? 我对如何利用现有的DIM.DATE做到这一点感到困惑?
I could then add more columns into my fact table.. 然后,我可以在事实表中添加更多列。
-- add column into fact table
ALTER TABLE FACT.SALES ADD shipped_date_id INT NOT NULL
ALTER TABLE FACT.SALES ADD invoice_date_id INT NOT NULL
-- add foreign key
ALTER TABLE FACT.SALES WITH CHECK ADD CONSTRAINT FK_shipped_date FOREIGN KEY (shipped_date_id) REFERENCES DIM.DATE(date_id)
ALTER TABLE FACT.SALES WITH CHECK ADD CONSTRAINT FK_invoice_date FOREIGN KEY (invoice_date_id) REFERENCES DIM.DATE(date_id)
But when I do my lookup, I can only pass in the "date_id" column.. I am confused how to make this work all together. 但是,当我进行查找时,我只能传递“ date_id”列。.我很困惑如何使它们一起工作。
Anyone able to clear this up for me? 有人可以帮我解决这个问题吗?
您必须对事实表中的每个DateKey字段使用多个LookUp转换... 1。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.