Minimize
08
 

Download code and sample file from our downloads section : (Tutorial 1 - Creating Your First SSIS Package)

 

The learning curve of SQL Server 2005 is like going from SQL Server 6.5 to 2000. Maybe even worse for DTS. Any knowledge of DTS you have now can be thrown out in SQL Server 2005. When I started to create my first DTS package, it was quite a humbling experience as I clumsily navigated around the interface. This tutorial will walk you through the creation of your first simple DTS package and guide you through some of the features.

 

The goal of this tutorial is to transform data inline from a flat file to another flat file without ever having to stage the data like you would typically have to do in SQL Server 2000. We’re going to take a sample file with just under 90,000 records and aggregate it, group it and sort it before inserting it into a new text file. You can also insert into a SQL Server just as easy. Traditionally in SQL Server 2000 or 7.0, you would have to insert data into a staging area, use a query to aggregate, sort and group it and then write the flat file out. This query won’t require any knowledge of how to query a SQL Server system. This tutorial is a variant of a sample that’s provided in the Beta 2 installation.

 

Before you begin, download the sample text file here that we use in this sample.

 

 

  1. Open the Business Intelligence Development Studio (Start | Programs | Microsoft SQL Server 2005). This is where you will typically create your DTS packages now. The environment as you can see is Visual Studio 2005 Beta 1.
  2. Select File | New | Project
  3. Under the Business Intelligence Projects Project Type, select Data Transformation Project. Call the project Tutorial1 under the Name text box. Click OK. This will create a new project and your first blank package called Package.dtsx.
  4. Double-click on Package.dtsx in the right-pane (Solution Explorer) under SSIS Packages.
  5. This will open the new Package Designer. You should start in the Control Flow tab. The Control Flow tab is where you start your workflow. Each time you transform data move data, you will automatically be redirected to the Data Flow tab. We’ll cover much more about these tabs shortly.
  6. There are lots of ways of doing data connections. You can create a shared connection that works across multiple SSIS packages or you can create one that has the scope of the existing package. In our example here, let’s start simple and just do a local connection. To do this, right-click in the Connections tab below and select New Flat File Connection.
  7. You are then taken to the New Flat File Connection dialog box. By now, you should have downloaded the sample file. If you haven’t downloaded the file, please download it here. Name this connection Sample File and no description is needed but it is useful metadata if you’d like. The file name should point to C:\DTS\SampleText.txt or wherever you placed the flat file. Another area that will be different than the defaults is to change the text qualifier to double-quotes (“). Here’s my properties screen.
    1. Before clicking OK, go through the other areas of the dialog box like the Columns screen.
    2. This part is very important and don’t skip this step as the rest of the tasks will rely on this. Go to the Column Properties screen. By selecting each column, you can see what data type SSIS is using for that column in the flat file. Select the column TransactionDate then under data type select date [DT_DATE]. A really cool feature here is you can click Suggest Type to have DTS sample the data and predict what you need. When it suggests the data type, it will predict for all the columns and not just the one you have selected. Click Suggest and OK to finish the rest of the columns. One thing I have noticed is you want to make sure the Quantity column is a 4-byte integer and not a 2-byte integer.
    3. Click Preview to confirm that the settings you choose are good.
    4. After you see data on the Preview section, then you’re ready to select OK.

bkDTSTutorial1-1.JPG 

  1. You’ll now see the new connection at the bottom. We’ll create another one of these later to show you another method of doing this.
  2. In the far left pane, you should be able to see the Toolbox tab. Hover over Toolbox and click and drag the Data Flow Task control onto the Control Flow tab. (You can optionally pin the toolbox to your design environment by clicking the push pin.)
  3. Right click on the newly created task and select Rename. Type “Transform Flat File” as the new task name. (You can also left click on the task and modify the Name property in the Properties pane on the right). 
  4. Right-click on the Data Flow task you just renamed and select Edit. This will take you to the Data Flow tab.
  5. Once on the Data Flow tab, drag and drop the Flat File Source data flow item onto the design pane from your Toolbox in the left.
    1. You may want to optionally rename the data flow item by right-clicking the item and selecting Rename. I renamed mine to Sample File.
  6. Right-click on Sample File data flow item and select Edit. Under the Connection option in the left pane ensure that Sample File is selected for your connection. Next, go to the Columns section and uncheck most of the columns, leaving only ProductID, TransactionDate, Quantity and ActualCost.

    bkDTSTutorial1-2.JPG

Pages: 1 of 4 Next Page

Comments

Anonymous User
# Anonymous User
Thursday, December 01, 2005 9:26 PM
I run my SSIS package and get this error: ERROR : errorCode=-1071636471 description=An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Arithmetic overflow error converting numeric to data type numeric.".
helpFile=dtsmsg.rll helpContext=0 idofInterfaceWithError={8BDFE893-E9D8-4D23-9739-DA807BCDC2AC}

The question is: how do I trace back the interface id with the error to a meaningful name, like a table name, etc. Is there a way?
Philip
email: philip_38@hotmail.com
Anonymous User
# Anonymous User
Friday, March 03, 2006 10:11 AM
Very good, but i dont like
Anonymous User
# Anonymous User
Monday, July 10, 2006 5:12 AM
very good one to start with
kushal kumar
# kushal kumar
Tuesday, August 29, 2006 4:28 AM
Good Explanation with step by step.
Nice for Introduction.
Anonymous User
# Anonymous User
Tuesday, August 29, 2006 9:14 AM
very good- i like
Anonymous User
# Anonymous User
Wednesday, September 20, 2006 9:47 AM
Good tutorial. Unfortunately it doesn't tell you how to run the package after you have saved it to the server.
nitin pai
# nitin pai
Tuesday, October 31, 2006 10:12 PM
Its terrific ! good job. for me i had no clue about how to use SSIS or DTS or whatever. This has given a gr8 headstart and set the ball rolling as far as learning SSIS goes. Thanks a lot!
Ismail
# Ismail
Wednesday, July 25, 2007 1:35 AM
Excellent article. Looking foward to the next tutorial
David
# David
Monday, August 06, 2007 7:56 PM
Great start. Onto the next tutorial.
dvmorris
# dvmorris
Monday, March 10, 2008 9:37 AM
Where can I download the sample text file. that link doesn't work.
Madhu
# Madhu
Thursday, April 24, 2008 2:28 AM
It would be nice if demonstrated different transformations in workflow and dataflow

Post Comment

Only registered users may post comments.

LatestArticles Minimize
Changing Granularity of Leaf Level Calculations in SSAS Tabular by Jason Thomas

Finding Nearest Stores using SSRS Map Reports by Jason Thomas

Heat Maps for SSRS using Map Control by Jason Thomas

Parameters for Analysis Services Reporting: Introduction, Pt. 3 by William Pearson
BI Architect Bill Pearson continues an extended examination of parameterization within Analysis Services reports. In this, Part 3 of the article, we continue to get hands-on practice cr...

Parameters for Analysis Services Reporting: Introduction, Pt. 2 by William Pearson
BI Architect Bill Pearson continues an extended examination of parameterization within Analysis Services reports. In this, Part 2 of the article, we continue to get hands-on practice cr...

Using Annotation Tables in SSAS to Show Last Processed Time and Latest Data Updates as a Measure in a Cube by John Hall

Using Color in SSRS Charts by Melissa Coates
Effective data presentation techniques help users  interpret information quickly and reliably.  Layout, formatting, sizing, labeling, and other report elements may all be used to facilitate ...

Is TOAD faster than BIDS Query Builder? by John Hall

SSRS: Unexplained Warning “This field is missing from the returned result set from the data source” And Checking a Field for Null Exception by John Hall
If you ever see the warning message “This field is missing from the returned result set form the data source” and get unexplained #Errors in columns on your report it may be from SSAS not returning a ...

Beyond Excel pivot tables: Leveraging cube formulas with MDX by Javier Guillen
PowerPivot and DAX are a powerful technologies, but there is still a good amount of work that can be done with traditional cube functions. In its current version, PowerPivot lacks the concept of ...


Advertisement Minimize

Advertisement Minimize

Copyright 2004-2012 MSBICentral.com Terms Of Use Privacy Statement