Exercise: Add new genres to a lookup table, then import a list of films

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the course listed below!

Category ==> SSIS Integration Services  (40 exercises)
Topic ==> Lookup transforms  (4 exercises)
Level ==> Harder than average
Course ==> Introduction to SSIS
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

In Management Studio. open the SQL script in the above folder and execute it.  This should create two tables:

Two tables created

The aim of the exercise is to import a list of films into the FilmsForLookupExercise table, setting the genre id for each (and adding any new genres which don't exist).


Create a package whose control flow should contain four tasks:

Part Type What it should do
1 Execute SQL Delete any existing rows in the FilmsForLookupExercise table.
2 Data flow Import the films from the workbook in the above folder, matching the genre to the Genre table in SQL Server and adding any new genres found to this table.  The resulting of running this part should be to add two new genres to the table, which will automatically be given the numbers 23 and 24 (the next available numbers).
3 Data flow Import the films again, matching the genre to the Genre table (which we now know will work), and returning the genre id.  Send the results of this to the FilmsForLookupExercise table.
4 Data flow Import the FilmsForLookupExercise table rows, and use a conditional split to show only those where the genre id is more than 22 (ie films for genres just added).  Use a data viewer to show these rows.

The GenreId column is an identity one, which means that when you add a new genre row the id number will automatically be set to one greater than the previous maximum.  Be careful to add only one row for each new genre found!

As well as adding rows to the Genre and FilmsForLookupExercise tables, the package should produce the following data viewer:

The final films shown

There are 3 films in the Software genre, and one in the Dark side genre.

When you've got this package working, close it down!

This page has 0 threads Add post