简体   繁体   中英

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

I am developing a SSIS package in which Source is 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 )

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. 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.

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. Once you have the dim tables loaded, you can lookup the ID's for each attribute in your fact table.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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