Solved

How to load OLTP data into Dimension and Fact table

Posted on 2013-06-07
4
993 Views
Last Modified: 2013-07-06
Experts,


I have a Dim Customer table and Dim Products table and a FactSaletable:

Dim Customer Table:

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target

Dim Products table:

ProductID       AlternateKey     ProductType        ProductName
1                     345354              Large                   Ball


FactSales table:

ID     CustomerID(FK)    ProductID(FK)      Qty     SalesAmount
1        1                          1                           2       $45


So I have created primary keys for all dimension tables which are foreign keys in the Fact table. Also a primary key for the fact table.

Now how am I suppose to load data into these tables from the OLTP database so items and
customer details are referenced accurately. I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.

Please let me know if you need further details. Any help would be greatly appreciated.


Many Thanks,

J3di
0
Comment
Question by:J3D1-KN1G1-1t
  • 2
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Racim BOUDJAKDJI
ID: 39228819
I dont know how to relate the OLTP data to the fact tables so it references the Dim tables.
You first fill your dimension tables then your fact table using INSERT statement based on selections from your OLTP.   Please make sure you use SELECT DISTINCT to avoid redundant rows.

Hope this helps.
0
 
LVL 23

Accepted Solution

by:
Racim BOUDJAKDJI earned 500 total points
ID: 39228822
Additionally, relating the table functionally to the new structure requires business knowledge so my guess is that it would be a good idea to involve the OLTP designers to establish that knowledge.
0
 

Author Comment

by:J3D1-KN1G1-1t
ID: 39231028
Thanks Racimo for your responses. I am aware of OLTP design and business processes.

What I really want to know is how does the dimension table know which row to look at in the fact table.

For example the DimCustomer table has a primary key(CustomerID=1) which is the foreign key in the Fact table. The Alternate key is the actual (CustomerID=34525) in the OLTP database.

So lets say I'm loading the DimCustomer table with :

CustomerID     AlternateKey     CustomerName       CustomerCompany
1                      34525                James Boags            Target


How do I relate and load this information into the fact table. I would understand if the primary for the DimCustomer 34525(alternate) and then this is the foreign key in the fact table. So all inserted data from OLTP is matching in relationship of the ROLAP database.

I get lost in ROLAP concept when there is new customerID in the DIM table and the OLTP key becomes the alternate key.

So I guess If you could please explain the concept or give an example I could better understand.

Many Thanks
0
 

Author Comment

by:J3D1-KN1G1-1t
ID: 39231231
After researching I came up with this. Please let me know if it correct.

If I'm loading measures from the OLTP source into Factable. I would have to

1. Lookup the primary key of DimTable by referencing the alternate key with the ID from source DB

2. Add the DimTable Primary KeyID in the fact table and then add then add the measure in.

3. Which means I would have a view or table setup in the the OLTP(with multiple joins) showing Dim and Measure information in a single row. (this would be my source)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now