Crime DataMart Design Setup Instructions
Crime DataMart Design Setup Instructions
1|Page
Create a “Database Diagram” so that you can see the Data Mart Design
o Under the “Crime” Database, right-click on the “Database Diagrams” folder and choose
“New Database Diagram”. You may receive this message:
o Click “Yes” to this message if it is displayed. This will open the “Add Table” dialog.
o Select one table at a time listed in the “Add Table” dialog (NOTE: Do NOT add the
“Source_Data_Staging” table) and click the “Add” button to add them to the diagram:
o Click the “Close” button once you’ve added all tables (except the “Source_Data_Staging”
table).
o Now click the “Save” button ( ) in the upper left hand side of the upper menu bar.
This will open the “Choose Name” dialog.
o Type “CrimeDataMart” in the “Enter a name for the diagram” field:
2|Page
Execute the ETL Package
Be sure you have downloaded and “unzipped” the “CrimeETL.zip” folder.
From your Programs menu expand “Microsoft SQL Server 2012” and launch SQL Server Data
Tools (SSDT)
Once you have launched SSTD click on the “Open Project” link:
The “CrimeETL” package will then load within SSDT in “Design” mode.
Update the “Connection Managers” within the package:
o Locate the SQL server connection called “localhost.Crime” in the “Connection
Managers” Section:
o Double-click the “localhost.Crime” connection to load the “Connection Manager” dialog.
o While in the “Connection Manager” dialog change the “Server name” field to the name
of your local SQL Server Instance. If you’re not sure what to type as your “Server name”,
3|Page
type the exact name of the server listed in the “Object Explorer” of SQL Server
Management Studio.
o If you have the correct “Server name” listed in the field, you should be able to click the
drop-down in the “Select or enter a database name” field and choose the “Crime”
database.
o Here is what your “Connection Manager” should look like (your Server name will be
different):
o Click the “Test Connection” button to ensure that you are able to connect to the
“Crime” database. Then click the “OK” button to close the dialog.
o Now you need to double-click the open the “Source Crime Data” data source in the
“Connection Managers” section and update its connection to the “2006 - 2008 Crime in
the United States (Data.gov)-CityCrime.csv” file. This will open the “Flat File Connection
Manager Editor”.
4|Page
o Click the “Browse” button to locate your local csv file that contains the data.
o While browsing for your .csv file, be sure to change the file type drop-down in the lower
right-hand corner of the dialog to “CSV files (*.csv)”.
o Choose your .csv file and click the “Open” button.
o If you receive a warning dialog after clicking “Open”, just agree to the dialog.
o While still in the “Flat File Connection Manager Editor” click the “Columns” tab on the
left side of the dialog. Review the Columns listed.
o Click “OK” button to close the “Flat File Connection Manager Editor”.
o Your “Connection Managers” are now set.
At the bottom of your project in the “Error List” section of Visual Studio you may see 2 Warning
similar to the following. Ignore these warnings. They are displayed because you are re-using an
SSIS package that was created on another PC.
5|Page
The “CrimeETL” SSIS package is now ready for execution.
o Locate and click on the “Start Debugging” button in the menu bar at the top of Visual
Studio:
o Wait for the SSIS package to complete all steps. Upon completion your screen should
look like this:
SELECT
CrimeState.[State],
CrimeCity.City,
CrimeYear.ChineseNewYear,
Crime.Robbery
FROM Crime.FactCrime AS Crime
INNER JOIN Crime.DimYear AS CrimeYear ON Crime.YearID = CrimeYear.YearID
INNER JOIN Crime.DimCity AS CrimeCity ON Crime.CityID = CrimeCity.CityID
INNER JOIN Crime.DimState AS CrimeState ON CrimeCity.StateID = CrimeState.StateID
WHERE CrimeState.[State] = 'Florida'
AND CrimeYear.ChineseNewYear = 'Rat'
ORDER BY CrimeCity.City ASC
6|Page
You should see 298 Rows of data return that look like this:
State City ChineseNewYear Robbery
Florida Alachua Rat 6
Florida Altamonte Springs Rat 68
Florida Altha Rat 0
Florida Apalachicola Rat 0
Florida Apopka Rat 151
Florida Arcadia Rat 21
Florida Astatula Rat 0
Florida Atlantic Beach Rat 24
Florida Atlantis Rat 1
Florida Auburndale Rat 37
Florida Aventura Rat 41
Florida Bal Harbour Village Rat 0
Florida Bartow Rat 39
Florida Bay Harbor Islands Rat 0
Florida Belle Glade Rat 84
Florida Belleair Rat 0
Florida Belleair Beach Rat 0
Florida Belleair Bluffs Rat 2
Florida Belleview Rat 7
Florida Biscayne Park Rat 5
Florida Blountstown Rat 2
Florida Boca Raton Rat 74
Florida Bonifay Rat 1
Florida Bowling Green Rat 1
Florida Boynton Beach Rat 205
Florida Bradenton Rat 160
Florida Bradenton Beach Rat 1
Florida Brooksville Rat 14
Florida Bunnell Rat 12
Florida Bushnell Rat 2
Florida Cape Coral Rat 93
7|Page