consider a true-life data export requirement that is best served by
using SSIS. The requirement is for a small business intelligence data
mart (on SQL Server 2008) to be spun off each week from the main OLTP
database (also on SQL Server 2008) that addresses a product sales
manager’s need to see the total year-to-date business that a customer
has generated. This data mart is merely a standard SQL Server database
and tables that have been transformed (that is, aggregated) for a
targeted purpose. As an option, the manager would also like to spin off an Excel version of this (or at least a comma-delimited .csv
file for Excel), which will be distributed via email to all salespeople
in the region. This overall requirement has been named “Hot Customers
Plus” to indicate the emphasis on customers who are generating
significant business for the company (and they will be customers who
have made greater than $5,000 worth of orders). The offloaded data mart
is on a separate machine from the critical OLTP system for all the
right reasons; no reporting or ad hoc queries are done against the OLTP
system. This process must be repeated on a weekly basis as a total
refresh (see Figure 1). We use the AdventureWorks2008 database for this example.
Figure 1. Creating a data mart and a comma-delimited flat file from an OLTP database, using SSIS.
Essentially, order data from the OLTP database (contained in the Customer, Product, Store, SalesTerritory, SalesOrderHeader, and SalesOrderDetails tables) must be aggregated for every order for each customer. In addition, the total amount to be stored in the YTDTotalSales
column in the data mart has to be extended out to reflect the summary
of each product for each customer. The manager is also interested only
in customers who are ordering products that total $5,000 or more.
Although the requirements are many, SSIS should be able to handle all
this with no problem.
So that you can get a good
feel for the two main SSIS tool capabilities, this chapter takes you
through generating the solution to this requirement using the SSIS
Wizard first, and then we walk through the same solution using SSIS