1. SQL Server 2008 Portfolio
JIM KILLIAN
jimk@everyware.org
(818) 362-7546
Samples of coursework completed while participating
in The Master's Program: SQL Server Training Track
from SetFocus, LLC.
Featuring:
SSMS - SQL Server Management Studio 2008
SSIS - SQL Server Integration Services 2008
SSRS - SQL Server Reporting Services 2008
2. Table of Contents
Introduction 3 rptTopSales.rdl 20
What is the SetFocus Master’s Program? 4 rptSalesMatrixByYear.rdl 22
PiggyBank Project 5 Report Manager Schedule 24
Table/Relationship Diagram 6 BlockFlix Project 25
AccountDeposit 7
Table/Relationship Diagram 26
AccountWithdraw 8
Bulk Purchase Import XML File 27
CustomerAccountUpdate 9
XML Import SSIS 28
Views 10
Online Queue 29
DDL and DML Triggers 11
rptLostDamaged.rdl 30
SSIS/SSRS Project 12 rptCustomersByMembershipType.rdl 31
Import Ship Methods 13 rptMostActiveCustomers.rdl 32
Import Vendors 14 rptMostRentedMovies.rdl 33
Import Products 15 rptInventoryListing.rdl 34
Import POs Control Flow 16 Proposals 35
Import PO Headers Data Flow 17
Import PO Details Data Flow 18
Update Price Control Flow 19
2
3. Introduction
This portfolio contains examples of my development skills in Microsoft SQL Server 2008.
These are products of my work during the 9½-week hands-on experience in SetFocus'
The Master's Program: SQL Server Training Track.
SetFocus utilizes the Microsoft Official Curriculum (MOC) customized with its own
training materials. Below is a brief outline of the topics covered:
● RDBMS Concepts
● Writing Queries using MS SQL Server 2008 T-SQL
● Implementing a Microsoft SQL Server 2008 Database
● T-SQL Programming Project (PiggyBank)
● Advanced SQL Querying and Programming
● Microsoft SQL Server 2008 Integration Services (SSIS)
● Microsoft SQL Server 2008 Reporting Services (SSRS)
● SSIS/SSRS Project
● Final Team Project (BlockFlix)
In addition to the coursework and programming labs, the program included challenging
real-world projects where I applied the skills developed in class.
3
4. What is the SetFocus Master’s Program?
The SetFocus Master’s Program: SQL Server Training Track…
● …is an intensive, hands-on, project-oriented program that
combines knowledge and valuable experience in putting the
SQL skill set to use in a simulated work environment.
● …provides in-depth hands-on experience focused on T-SQL
Development, SSIS Packages, and SSRS Reports and deployment.
● SetFocus projects are real-world simulated projects. Project
specifications were provided and course of action determined
with deliverables due within tight scheduling deadlines.
4
5. PiggyBank Project
The goal of this project was to create a database for a fictitious bank utilizing stored
procedures, functions, views, and DDL and DML triggers. It was stated in the specification
that another team would be responsible for creating the user interface for working with
our input requirements and the data we return. Some of the required functions of the
database include:
● Creating and updating customer information.
● Creating and updating customer accounts.
● Adding a new customer to an existing account.
● Opening and closing accounts.
● Preventing account deletions (closing them instead).
● Performing transactions such as deposits, withdrawals and money transfers.
● Charging overdraft and other applicable fees to both Checking and Savings accounts.
● Applying interest rates to savings accounts.
● Obtaining account history for the current month or any specified month.
● Queries to search for customers by name, phone number, or account number.
● Implementing ATM procedures to display current balance and transactions.
I received 100% on this project.
5
7. PiggyBank – AccountDeposit
After determining that the
Account and other data
passed as parameters are
valid for a deposit, the
CurrentBalance column is
updated and a row is added
to the Transactions table.
The new balance amount is
returned to the calling
statement via the
@NewBalance output
variable.
7
8. PiggyBank – AccountWithdraw
After verifying that
the Account and
other data passed
as parameters are
valid for a
withdrawal, the
need for an
overdraft and what
type is determined.
In the case of an The new balance amount
overdraft, the will be returned to the
procedure calls calling statement via the
itself recursively @NewBalance output
to get the parameter.
required funds,
which are then
deposited before
completing the
original
transaction.
8
9. PiggyBank – CustomerAccountUpdate
This procedure is central to the project, as
only a customer associated with an account
has access to it.
The procedure verifies that the Customer,
Account and other data passed as parameters
are valid, and whether or not they are already
associated with each other.
The number of customers
associated with this account
(@CustsAcct) and the number
of accounts associated with
this customer (@AcctsCust)
are returned via the
associated output parameters.
9
10. PiggyBank – Views
This view displays information for all
of the accounts associated with each
customer, enabling simpler querying.
This view returns the information
required when a customer requests
account history via an ATM.
10
11. PiggyBank – DDL and DML Triggers
This DDL trigger prevents tables and
views from being dropped (deleted) or
altered (modified).
This DML trigger prevents rows from
being deleted from the Account table.
11
12. SSIS/SSRS Project
The goal of this project was to take historical spreadsheet (CSV) data for a
company's list of products, vendors, and purchase order history, and load the
data into a SQL Server database. Some of the requirements include:
● The load process needs to work on a go-forward basis, so that
new/modified products/vendors/orders can be loaded into the database as
well.
● The load process for orders should validate that any incoming orders with
product numbers or vendor numbers that do not match an existing
product/vendor number should NOT be written to the SQL Server database.
Instead, this data should be written to an exception file and emailed.
● Build two reports :
rptTopSales.RDL – Top vendor and product sales
rptSalesMatrixByYear.RDL – Sales by vendor and ship method across
years
● Schedule rptSalesMatrixByYear.RDL for a report snapshot and email
subscription
I received 100% on this project.
12
13. SSIS/SSRS – Import Ship Methods
The CSV file format was
provided.
If the Shipper is not found in
the database, a new row is
inserted.
If the Shipper is found in the
database, it is checked to see if
any of the data has changed.
If the Shipper data has
changed, the row is updated.
If the Shipper data has not
changed, no action is taken.
The work was being performed on a Virtual Server,
so the connections were all via “localhost”.
13
14. SSIS/SSRS – Import Vendors
The CSV file format was
provided.
If the Vendor is not found in
the database, a new row is
inserted.
If the Vendor is found in the
database, it is checked to see if
any of the data has changed.
If the Vendor data has
changed, the row is updated.
If the Vendor data has not
changed, no action is taken.
The work was being performed on a Virtual Server,
so the connections were all via “localhost”.
14
15. SSIS/SSRS – Import Products
The CSV file format was
provided.
If the Product is not found in
the database, a new row is
inserted.
If the Product is found in the
database, it is checked to see if
any of the data has changed.
If the Product data has
changed, the row is updated.
If the Product data has not
changed, no action is taken.
The work was being performed on a Virtual Server,
so the connections were all via “localhost”.
15
16. SSIS/SSRS – Import POs Control Flow
The CSV file format was
provided.
Any CSV files with appropriate
names are processed in the
ForEach Loop.
After each file is processed,
any rows with bad products or
vendors (if the associated
variable is greater than zero)
are emailed to the appropriate
department for reconciliation.
The work was being performed on a Virtual Server,
so the connections were all via “localhost”.
16
17. SSIS/SSRS – Import PO Headers Data Flow
The CSV file format was If the vendor or product is not found in the
provided. database, the associated variable is incremented
by one and the row is written to a CSV file.
The detail data is totaled for the header.
If the PO doesn't exist in the database,
The work was being performed on a Virtual Server, it's created, otherwise it's updated.
so the connections were all via “localhost”.
17
18. SSIS/SSRS – Import PO Details Data Flow
The CSV file format was If the PO header or product is not
provided. found in the database, the row is
written to a CSV file. This should never
happen, as the POs were created and
products validated in a previous step.
The TotalDue column is added and populated. If the detail row doesn't exist in
the database, it's created, otherwise it's updated.
The work was being performed on a Virtual Server,
so the connections were all via “localhost”.
18
19. SSIS/SSRS – Update Price Control Flow
This package does a bulk update of the
list price of any product whose name
contains a specified string.
The SQL Statement is an expression
based on two variables, which are
populated by the configuration file,
which makes it possible to modify the
update without having to open BIDS
or SSMS.
The ListPrice of any row whose
ProductName includes the string in
@NameSearch is multiplied by the
value in @PriceMultiplier.
The work was
being performed
on a Virtual
Server, so the
connections were
all via “localhost”.
These variables are populated by
the configuration file.
19
21. SSIS/SSRS – rptTopSales.rdl
The dates and number of
top vendors and products
to display are specified in
the parameter fields at the
top, and are included in
the page header
information.
As shown here, ties are
included via use of the
DENSE_RANK aggregation.
21
22. SSIS/SSRS – rptSalesMatrixByYear.rdl
A matrix is used to
provide the aggregated
values for the sales per
year for each product in
the dataset.
The data for this report
is from this query:
22
23. SSIS/SSRS – rptSalesMatrixByYear.rdl
The ship methods to
include are selected in the
parameter drop-down at
the top and are displayed
in the page header.
23
24. SSIS/SSRS – Report Manager Schedule
This is the schedule used to create the report
snapshot and run two linked reports. The results
are emailed to the appropriate personnel.
24
25. BlockFlix Project
As the final project of the course, BlockFlix (a new movie rental company) was designed to
utilize almost all of the SQL skills we had developed. It was also our only team-based project,
so we worked in teams of three in order to simulate a real-world environment, including many
of the situations encountered when working as only one part of a development team. Some of
the requirements include:
● There is a central database as well as remote databases for stores and kiosks which are
updated via SSIS daily (no constant connection).
● A new website will be created to allow customers to rent movies online. This Web site
requires all access to the database be via stored procedures.
● Bulk movie purchases will include an XML file with the data to be imported into the
central database and distributed to the remote sites as appropriate.
● An online queue is required to allow the customer to specify the order in which movies
are to be shipped. The queue must be updated when a disc is returned.
● Six membership packages were specified, which include the monthly fee and number of
movies which can be loaned out at any time. There is no late fee.
● Store and kiosk locations rent movies for $1 per day, billed daily to a credit card. No
membership or customer account is required, just a valid credit card.
● Stores can also sell movies and other merchandise.
● Customers are to be assessed a fee of $4.99 for each damaged or lost disc.
● Management requested four online reports be available to them in XLS and PDF formats.
● There is a request for proposals for a backup and maintenance plan, and future online
video streaming.
25
27. BlockFlix – Bulk Purchase Import XML File
This is the sample XML file used in our presentation to
demonstrate importing new movies into the system. My
teammate chose parameters vs. elements for the XML style.
(The file was split into two columns to better fit the slide.)
27
29. BlockFlix – Online Queue
Starting with an empty queue, add The customer can remove a movie from the queue, to get
5 movies to get the resulting rows: the resulting rows:
When the disc is returned, the DateOut, AccountID, and
Unavailable fields for the disc are reset:
The movie at the top of the queue ships, to get the
resulting rows:
Which sets the DateOut, AccountID, and Unavailable
fields for the disc:
29
35. BlockFlix – Proposals
Backup / Maintenance Plan
● Database backups and transaction log backups on a scheduled basis
o Database backups - once a week
o Transaction log – Daily
● Run SSIS Packages – Daily
● Run SSRS – No reports are currently scheduled to run automatically, but this can be
modified as needed.
Hardware
● Central Database
o Microsoft SQL Server 2008
● Stores
o Microsoft SQL Server 2008
o Need VPN connection to sync data
● Kiosks
o Video/Rental Machine
o Need VPN connection to sync data
35
36. BlockFlix – Proposals (continued)
Online Video Streaming
● All DVD rental memberships (possibly above a minimum cost/month) should include
access to streaming video
● A separate membership type for “streaming only” should be implemented
● Movies should be added to the list of “available streaming” in order of rental
popularity or member requests
● A separate queue for streaming should be implemented, keyed by CustomerID
● All online activities (searching, queue building, “suggested viewing”, etc.) should be
by CustomerID, not AccountID
● Investigate inclusion on non-PC devices such as game consoles (PS3), set-top boxes
(Roku), cell phones, DVD players, and TVs
● Be aware of frustrations encountered by users on other services and work to avoid
them (e.g., episode/season sorting problems within a series)
36