Ssis (SQL Server Integration Service)

Embed Size (px)

DESCRIPTION

good one

Citation preview

SSIS Lesson 1 - Introduction to SSIS

SSIS( SQL Server Integration Services ) is one of technologies which isin high demand currentlyin IT industry.

All organizations (be it small, medium or large) have to maintain their data in different databases like spreadsheet, flat files, RDMS systems etc.

Sometimes we need to access data from different sources and need to modify the data according to business needs. Need for accessing the data from multiple data sources and need for performing broad range of data migration tasks and transforming them according to the business needs has been very much in demand now.

In 2000, Microsoft released DTS (Data Transformation Services) to transform data from one source to different destination.

After 5 years in 2005, Microsoft launched another version of DTS with more powerful features. This is named as SSIS.SSIS is more powerful than DTS and its user friendly. SSIS has wide range of new features added to it. SSIS is part of SQL SERVER Business Intelligence Studio.

Following Services are part of SQL SERVER Business Intelligence Studio.:

SSIS (SQL Server Integration Services ) SSRS (SQL SERVER Reporting Services) SSAS (SQL SERVER Analysis Services)

SSIS is one of the most powerful features which were introduced in SQL Server 2005.

SSIS is an ETL (extract transform and load features) tool.

SSIS Definition:

SSIS can be defined in various ways which are listed below.SSIS is a:

ETL(extract transform and load features) tool Control flow engine Application platform High-performance data transformation pipeline Data import/export wizard

As already mentioned SSIS is the successor of DTS.But, DTS and SSIS have very few things in common. DTS code is completed rewritten to design and build SSIS.

Lots of new features are added in SSIS. Some of the new features in SSIS are listed below.

Latest features in SSIS:

For Each loop containers Package configurations Property expressions Better Active X controllers Script tasks Control flow and Data flow are separated to provide better design and to make project/code more readable and understandable Event Handlers Precedence constraints are improvised to handle conditional checks/Conditional Expressions. Pivot and Un pivot

Building Blocks of SSIS:

Control Flow:Work flow or Process flow in SSIS is known as Control flow.Control flow consists if one of more tasks that will be executed when SSIS package runs. Data Flow:Data Flow in SSIS defines/indicates how data should flow from one data source to other destination. It holds information about data source, data destination and data transformation. Even Handlers:Event handlers are the tasks that are executed when some event occurs during SSIS package execution. Ex: If some error occurs during SSIS package execution, then event handler can be programmed to run to ignore that error and continue to the next step. Package Explorer:Package Explorer contains complete information about the Variables, Precedence constrains, Event handlers, Connection Managers, Log providers, Executable. Precedence Constraints:Precedence Constraints links various tasks in SSIS. In simple words it is the arrow marks that connect 2 difference tasks in SSIS. Based on the direction of Precedent Constraints tasks will be executed in order. In other words Precedence constraints are needed for ordering / organizing the control flow in SSIS. Connection Managers:Connection Managers contain information that is needed to connect to various data sources and to data destinations. Toolbox:Toolbox contains is collection of Control Flow items, Maintenance plan Tasks, Data Flow Sources, Data Flow Destinations and Data Flow Transformations. In simple words Toolbox in SSIS contains different tasks/ containers. Task is nothing but a work unit to perform certain job/work/action. Variables:Variables parameters store information that can be used by Containers/tasks in SSIS during the SSIS package execution.

Advantages of SSIS:

SSIS has a very user friendly Graphical User Interface (GUI) through which difficult tasks can also be done with very much ease. We can perform differenttypes of tasks (like loading data, extracting data, renaming file, sending mails, sending files through FTP , Data mining and lot more) in a single SSIS package without any manual intervention. SSIS package can be scheduled to run at a given time as per the business needs. SSIS can be used to connect to different data sources (like flat file, MS Access, Excel, SQLS ERVER, SYBASE, MYSQL, ORACLE etc.,). In simple words using SSIS we can connect to almost all the external data sources. Deploying SSIS package is very easy.

SSIS Lesson 2 - SSIS Data Import/Export Wizard to Load Data

In this article, I will explain you how to create 1stSSIS package using SSIS data Import and export Wizard.Lets create an SSIS package to load data from Excel sheet into a table in sql server.Follow the below steps to create SSIS package.

Go to Start --> All Programs --> Microsoft SQL Server 2005--> SQL Server Business Intelligence Development Studio.

Click on SQL Server Business Intelligence Development Studio. Following Screen will be displayed.

Click on File --> New-->Project

Select Business Intelligence Studio from the left side list and Select Integration Services Project. Then, Provide the Name for your SSIS Package. Here I gave name as Load Data_SSIS_1. Then, click on OK.

SSIS Package will be created as shown below:

Go to Project--> SSIS Import and Export Wizard.

When you click on SSIS Import and Export Wizard , following screen will appear:

Select Data Source--> Microsoft Excel Select Excel File Path and Click on Next

Select Destination--> Microsoft OLEDB Provider for SQL Server" Select Server name and Database. Then, Click on Next

Select the Spread Sheet Name from the Source and tables from Destination.

Click on Edit Mappings .Map source and destination fields. Then, click on Ok

Then Click on Next-->Finish

Click on Close. SSIS Package will be created as shown below:

Now, the SSIS package is ready. This SSIS Package can be executed by clicking on Start Debugging icon or by pressing F5.

Before Executing this package, let me show you the data in STUDENTS table in database (SQL SERVER).STUDENTS Table dont have any information.

Now, Execute the SSIS package by Pressing F5. All executables in the Control Flow of SSIS package are turned to Green Color. Which indicates SSIS Package is executed successfully.

Now, lets check the data in STUDENTS Table after SSIS package execution.

Data from the Excel file is loaded into STUDENTS table.

Using SSIS data from any source can be Loaded /Extracted into any destination.

Video tutorial for loading data from excel into a sql server table using SSIS:

SSIS Lesson 3 - SSIS Import and Export Wizard to Extract Data

In the earlier article, I have explained about how useSSIS import and Export Wizard to load datafrom one source to other destination. I have given the example to load data from Excel file into a table in sql server.

In this Chapter, we will see how to use SSIS Import and Export wizard to extract data from one data source to other destination.

Lets see how we can use SSIS import and Export Wizard to perform data extract operation with an example for extracting data from a table in sql server into a flat file.

Go toStartAll ProgramsMicrosoft SQL Server 2005SQL Server Business Intelligence Development Studio.

Click on SQL Server Business Intelligence Development Studio. Following Screen will be displayed.

Click on FileNewProject

Select Business Intelligence Studio from the left side list and Select Integration Services Project. Then, Provide the Name for your SSIS Package. Here I gave name as Extract_Data_SSIS. Then, click on OK.

SSIS Package will be created as shown below:

Go to ProjectSSIS Import and Export Wizard

Welcome Screen for SSIS Import and Export Wizard will appear. Click on Next

Choose the appropriate data source from the drop down menu . Here in this example we want to extract data from sql server table. So, Choose data source as Microsoft OLEDB Provider for SQL Server. Connectto the required Server and Database as shown below. Then, Click on Next

Choose the appropriate Destination. In this example, we want to extract data from sql server table into a flat file. So, chose destination as Flat File Destination and provide the destination path. Select the Column Names in the first data row Check box if you want to display column names in the extract file. Then Click on Next.

Following Screen will appear. Then click on Next

Select the Source table Name. I am using STUDENTS table in this example. So, I have selected STUDENTS table from the drop down tables list. Also, Specify the Row Delimiter and Column Delimiters to be used in the extract file.

For this example, I am using New Line {CR}{LF}as therow delimiter and Comma(,) as the column delimiter.

By Clicking on the Preview button we can they see the data preview

Click on Next once your done with choosing table name and delimiters for the file. Click on Finish to complete the SSIS Import and Export Wizard setup.

Once the Wizard setup is completed successfully, then following screen will appear. Click on Close to go the SSIS report.

Now, SSIS package is created by the SSIS import and Export Wizard successfully with 1 data flow task in the control flow panel. Control flow and Data flow Screen shots for this SSIS package are provided below.

Now, SSIS package can be executed by clicking on Start Debugging button or by pressing F5.

Before running the SSIS package let's check the data in the flat file and data in Sql server table STUDENTS.Data n Flat File:Flat file is empty.

Data in the STUDENTS table:

Now, Execute the SSIS package by clicking on Start Debugging button or by pressing F5.

SSIS Package is executed successfully. Lets check the data in the flat file now. Data is extracted into the flat file. Columns are separated by Comma delimiter and rows are separated by new line.

Similarly, we can extract data from any data source into any required destination.