Professional Documents
Culture Documents
Objective:: Creating Forecast Ssis - 1
Objective:: Creating Forecast Ssis - 1
Objective:: Creating Forecast Ssis - 1
enter a sales forecast by city and state. The city and state information will
be extracted from the AdventureWorksDW database and output to an Excel
spreadsheet.
Select Integration Services Project, and give the name to the project
SalesForecastInput
Step 2: The designer will now display an empty Control Flow. Click anywhere in the
Control Flow designer to bring up the package properties window.
The package properties window contains many properties that can be set for the package.
The following is an example:
ProtectionLevel
IsolationLevel
TransactionOption
ProtectionLevel = DontSaveSensitive
IsolationLevel = Serializable
TransactionOption = Supported
The ProtectionLevel provides for various options for encrypting the package and/or
portions of the package. We point this one out because the default value of
EncryptSensitiveWithUserKey will often cause problems. An example of sensitive
information is a database connection string that contains a password in it. The
Creating Forecast SSIS Page | 2
default setting will encrypt this information using the user key of the person who
created the package. When another user executes the package it will fail
because that user's key will not be able to decrypt the connection string. A
good way around this is to change the ProtectionLevel to
DontSaveSensitive, meaning you aren't going to put sensitive information in
the package so there's no need to worry about encryption.
The IsolationLevel property is setting the Transaction Isolation Level. Note that the
default value is Serializable which may not be what you really need. Serializable is
the level where read locks are held until a transaction commits or rolls back
which provides that no data read can be updated. In addition range locks are
held so that no data can be inserted such that rerunning any query in the transaction
would return the rows added which weren't there at the beginning of the
transaction. Surely there are times when this transaction isolation level is warranted
but certainly not always. The Serializable level generally results in additional locking
and decreased concurrency so you should consider whether you really need this and
choose one of the other levels such as ReadCommitted.
The TransactionOption allows you to choose how the package behaves with respect
to database transactions. The default value of Supported is probably a good one. If
a package is executed within an existing transaction (i.e. called from another
package) it will enlist or join the transaction which certainly makes sense as a
default. The other options are Required and NotSupported. Required means that
the package will always execute within a transaction, either joining the transaction of
the caller or creating its own transaction. NotSupported means the package does
not join an existing transaction or create its own.
Step 3: Let us create the connection Managers. A Connection Manager allows you to
connect with a Data Source or Data Destination
In this section we will add two data sources to our package - one to access the
AdventureWorksDW database and another to access our Excel spreadsheet.
You can see the Connection Area at the bottom or Designer package
To add the connection manager simply right click inside the Connection Managers area then
choose New OLEDB Connection from the popup menu,
and create the connection as follows
Step 4: Let us create the Control Flow, which contains the various tasks that the package
will perform.
On LHS, you will see the various Control Flow tasks as follows
There are quite a few built-in tasks available. For our current package we only need a Data
Flow task. Drag and drop the Data Flow Task from the Toolbox onto the Control Flow
designer. After doing so the Control Flow designer should look like this:
Step 5: Click on the Data Flow tab in the designer and you should see the empty Data
Flow designer as shown below:
As you can see there are quite a few built-in tasks available.
For our current package we want to
retrieve some data from the AdventureWorksDW database and output it to an Excel
spreadsheet. To do this we need an OLE DB Source and an Excel Destination.
In addition we need to add a column to the Data Flow; this column will be the
numeric column in the spreadsheet where the user enters the forecast amount.
For these Drag and drop an OLE DB Source, Derived Column, and Excel Destination from
the Toolbox onto the Data Flow designer. After doing so the Data Flow designer should look
like this:
Notice that the red icon is now gone from the OLE DB Source task and it is now properly
configured.
Step 6: Derived Column
The Derived Column task allows us to add a column to the Data Flow. Right click on it,
select Edit, then fill in the Derived Column transformation Editor as shown below:
Right click the Excel Destination task and select Edit from the popup menu. The Excel
Destination Editor dialog will be displayed. Click the New button next to the Name of the
Excel Sheet to display the Create Table dialog as shown below:
Step 10: Now click on Control Flow. Right Click on the package and select Execute Package
While the package is running you will see each task turn green if it completes successfully or
red if it fails. Here is the Control Flow after the package has run successfully:
Here is the Data Flow after the package has run successfully:
We can open the Excel spreadsheet that the package created and see the following (only a
portion of the spreadsheet is shown):
The above spreadsheet shows the columns from our query plus the Forecast column which
we added with the Derived Column task.