O'Reilly logo

Microsoft SQL Server 2012 Bible by Aaron Nelson, Jose Chinchilla, Patrick LeBlanc, Jorge Segarra, Adam Jorgensen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading Data

When loading a data warehouse, it typically starts with loading the dimensions and then the facts. The obvious reason is to satisfy the fact tables' foreign key constraints. In the SQL Server world, the Extraction, Transformation and Loading (ETL) is accomplished using SQL Server Integration Services (SSIS). Chapter 52, “Building, Deploying, and Managing ETL Workflows in Integration Services,” provides a detailed explanation of how to do this. Figure 51.3 shows a simple dimension load with SSIS, and Figure 51.4 illustrates a fact load. This chapter focuses on loading the data with pure Transact-SQL.

Figure 51.3 Simple Dimension Load from SSIS.

51.3

Figure 51.4 Fact load using SSIS.

51.4

Loading Dimensions

The source data has a tremendous effect on which method will be used when loading the data into the data warehouse. If you encounter a situation in which all the fact and dimension data has relatable column, or more preferably foreign, keys, the process is straightforward. To load a dimension you would compare the rows in the dimension table to the rows that are contained in the incoming source data. As a best practice, you should copy the source data into staging tables instead of loading data directly from your source system. This should eliminate the possibility of contention ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required