Presentation is loading. Please wait.

Presentation is loading. Please wait.

ETL Processing Mechanics of ETL.

Similar presentations


Presentation on theme: "ETL Processing Mechanics of ETL."— Presentation transcript:

1 ETL Processing Mechanics of ETL

2 The Flow Source File Extract Transform Transformed File Extract
Generate Key Presentation Mart Surrogate Keys

3 The Flow Customer Extract Transform Transformed File CopyCustomer
Generate Key Presentation Mart NewTable

4 Extract Customer data into a working table
SELECT * INTO SalesCopy FROM Sales;

5 Add Surrogate Keys Create a table with primary key and surrogate key attributes, transaction primary key as primary key and autoincrement for a new surrogate key

6 Create a Surrogate Key Table
create table surrogate ( keyval int constraint pk primary key, Autokey int identity(1,1), Surrogate int)

7 Insert primary keys into the surrogate key table and generate surrogate keys.
INSERT INTO Surrogate (KeyVal) SELECT KeyVal FROM Sales WHERE KeyVal NOT IN (SELECT KeyVal FROM Surrogate);

8 Copy the autonumber field into an integer field.
UPDATE Surrogate SET Surrogate= autokey WHERE surrogate is null

9 Add a CustomerKey column to the CustomerCopy table
ALTER TABLE Sales ADD SalesKey Int;

10 Update the CustomerCopy table to add surrogate keys.
UPDATE sales SET sales.saleskey = surrogate.surrogate FROM sales, surrogate WHERE sales.keyval = surrogate.keyval

11 Drop unnecessary columns
ALTER TABLE CustomerCopy DROP balance;


Download ppt "ETL Processing Mechanics of ETL."

Similar presentations


Ads by Google