简体   繁体   English

在SSIS中使用多个Dim表插入将数据插入事实表

[英]Inserting data into Fact Table with multiple Dim table insert in SSIS

I am developing a SSIS package in which Source is sql table : 我正在开发一个SSIS包,其中Source是sql table:
CREATE TABLE [dbo].[Stage_Clean]( [StudentName] [varchar](50) NULL, [Class] [int] NULL, [Subject] [varchar](50) NULL, [Marks] [int] NULL, [FullMarks] [int] NULL, [Remarks] [varchar](100) NULL )

The data from this source need to be export into Fact table and 2 dim table : CREATE TABLE [dbo].[FactResult]( [StudentName] [varchar](50) NULL, [ClassID] [int] NULL, [SubjectID] [int] NULL, [Marks] [int] NULL, [FullMarks] [int] NULL, [Remarks] [varchar](100) NULL ) 来自此源的数据需要导出到事实表和2个暗表中: CREATE TABLE [dbo].[FactResult]( [StudentName] [varchar](50) NULL, [ClassID] [int] NULL, [SubjectID] [int] NULL, [Marks] [int] NULL, [FullMarks] [int] NULL, [Remarks] [varchar](100) NULL )

CREATE TABLE DimClass ( ClassID INTEGER IDENTITY(1,1), Class INTEGER )

CREATE TABLE DimSubjects ( SubjectID INTEGER IDENTITY(1,1), Subjects VARCHAR(50) )

The data from Stage_Clean need to be transfer to FactResult with corresponding foreign id of column Class and Subjects. 来自Stage_Clean的数据需要传输到FactResult,其具有列Class和Subjects的相应外部ID。 Incase if there is new entry of Class or subjects in source, it will first insert class and subject into DimClass and DimSubjects respectively, then it will insert the corresponding foreign ids to fact table. 如果源中有新的Class或subject条目,它将首先将class和subject分别插入DimClass和DimSubjects中,然后将相应的外部ID插入事实表。

Thanks in advance.... 提前致谢....

This looks like a homework problem, so I won't give you the answer, but will give the the theoretical approach. 这看起来像是一个作业问题,所以我不会给您答案,但是会提供理论上的方法。 You'll need to load each of your DimTables first base on the distinct list of corresponding attributes. 您需要首先根据不同的对应属性列表加载每个DimTables。 Once you have the dim tables loaded, you can lookup the ID's for each attribute in your fact table. 一旦加载了暗表,就可以在事实表中查找每个属性的ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM