Step by step to create your first SSIS package-from Network

Source: Internet
Author: User
Tags ssis
Introduction

The purpose of this tutorial is to provide detailed steps on how to create a SSIS package. the package given below reads the data from a source tab delimited text file and based on certain conditions, saves the output in two separate Excel output files. the output Excel files also have the same header as the input text file. the structure and data for the source input file is given below:

Empid Empname DOB DOJ Salary
1 User1 1/1/1976 1/4/2000 20000
2 User2 1/2/1976 1/5/2000 20000
3 User3 1/3/1976 1/6/2000 20000
4 User4 1/4/1976 1/7/2000 30000
5 User5 1/5/1976 1/8/2000 20000
6 User6 1/6/1976 1/9/2000 40000
7 User7 1/7/1976 1/10/2000 20000
8 User8 1/8/1976 1/11/2000 35000
9 User9 1/9/1976 1/12/2000 20000
10 User10 1/10/1976 1/6/2000 20000
Steps to create your first SSIS package

1. Open Business Intelligence Development studio.

2. Click on file-> New-> project.

3. Select integration service project in new project window and give the appropriate name and location for project. and click OK.

4. The new project screen contains the following:

    1. Tool Box on left side bar
    2. Solution Explorer on upper right bar
    3. Property Window on lower right bar
    4. Control Flow, data flow, event handlers, package explorer in tab windows
    5. Connection Manager window in the bottom

5. Right click on the Connection Manager tab, click on new flat file connection menu item.

6. Connection Manager Editor opens up which contains 4 tabs, general, columns, advanced and preview.

    1. In General tab, enter Connection Manager Name and description (optional ). select source file, file format and delimiter. if first row of source file contains headers, then select the checkbox "column names in the first data row ".

    2. Select column tab and check whether all columns are properly mapped or not.

    3. Select Advance tab. Here you can add, remove or modify columns as per output stream requirement.

    4. Select preview tab to check how your output will look like:

7. Click on OK. It will create a flat file Connection Manager for your source file.

8. Now drag data flow task from the Toolbox into the control flow container.

9. Double click on the data flow task. It will show data flow container tab for selected data flow task. You can see three item categories in toolbox.

    1. Data Flow sources-Source makes data from different external data sources available to the other components in the data flow.
    2. Data Flow Transformations-Transformations can perform tasks such as updating, summarizing, cleaning, merging, and distributing data.
    3. Data Flow destinations-Destination writes the data from a data flow to a specific data store, or creates an in-memory dataset.

10. Drag a flat file source component from data flow sources into data flow container window.

11. Double click on the flat file source component, it will display flat file source editor. The window contain three tabs:

  1. Connection Manager-Here we will specify source connection manager which we created for source file. If source file containsNullValues, select "retain null values from source as null values in the data flow" checkbox.

  2. Columns-This Tab allows the user to select required output columns and user can also change the output column names.

  3. Error output-Using this tab, the user can decide the behavior of the component in case of failure. There are three options:
    1. Ignore failure: selecting this will ignore any failure while reading rows from source and the package will continue executing even any error occurred.
    2. Redirect row: selecting this will redirect the failed rows to other component which is connected with the error precedence constraints.
    3. Fail component: selecting this will stop the execution of package in case of failure.

12. drag and Drop a conditional split component from data flow transformations tab into data flow task container window. drag and connect the success output (which is shown by Green Arrow) of flat file source component to conditional split component.

13. Double click on the conditional split component, it will open conditional spilt component editor window. Here user can specify the condition (s) as per the requirement and click OK. For example:

    • Highersalary: [Salary]> 20000 (redirect records if salary is greater than 20000)
    • Lowersalary: For rest of the records

14. Drag and Drop Excel destination component from data destinations tab into data flow task container. Connect the success arrow of the conditional split component to excel destination, input output selection window will be popped up.

15. In the input output selection popup window, select appropriate conditional output for example"Highersalary"Conditional output and click OK.

16. Double click on the Excel destination component which will open Excel destination editor window. Click on the new ole db Connection Manager button.

17. Select destination file location and the appropriate Excel sheet name where you want to insert the success output data with salary values higher than 20000.

18. Click on the mapping tab and map the appropriate input columns with output columns.

19. On click of OK, error icon is shown in the destination Excel file component and it displays the message "cannot convert between Unicode and non-Unicode string data types ".

20. To resolve this issue, we need to insert a data conversion transformation component between conditional split and Excel destination component.

21. Double click on the data conversion component, it will open data conversion transformation editor. Using this component, convert input data types to required output data types.

22. click OK and connect the success arrow of data conversion component into Excel destination component. double click on Excel Data conversion component and click on the mapping tab and map the output of data conversion component to input of Excel destination component and click OK.

23. Rename the Excel destination component as"Records with salary> 20000"

24. now add one more data conversion transformation component and connect the second success output of conditional split to it. do the necessary data type conversions. add one more Excel destination component and rename it as "remaining records ". create a New Connection Manager and configure it to point to the second output file. connect the input of the newly added data conversion component to it and do the mapping as required.

25. Now the package is ready to be executed. Go to the Solution Explorer and right click on the package and select "Execute Package". If all components turn"Green", It means package has run successfully, if there is any error, the component which has failed to execute will be shown in"Red"Color. We can see the package execution steps in the" progress "tab.

26. Once you run the package, data will be saved in the destination output files as per the condition specified in the conditional split component.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.