Skip to main content

How To Create SSIS Package, Example With Diagrams


In this post we will try to crate a package that extract the data from 'Student Table' of Source-Database and load it successfully in 'Student Table' of 'Destination-Database'. You can Download or look into the sample database I am using.

System requirements for SSIS or Business intelligence Development:

  1. You should have installed SQL Server Standard or Enterprise version.
  2. I am using Visual Studio Add-in (SQL Server Data Tools) in this SSIS tutorial to design SSIS package. This needs SSDT also to be installed.


Once confirmed that SSDT is installed on machine. We are ready to create an ETL(Extract - Transform - Load) package.

So here we go!

Here are the scripts that you can run in order to generate two databases(Source and destination) with Tables in it.

Go to Start Screen or Click Start Button. Go to Microsoft SQL Server and you will find 'SQL Server Business Intelligence Development Studio' under this.

How to open SQL Server business intelligence development studio
Open SQL Server business Intelligence Development Studio




This opens a instance of Visual Studio. Click on File tab and select 'New Project'. Chose 'Business Intelligence Projects' as project type and select 'Integration Services Project', type a sensible name for your project(I have given it Simple Data Transfer, that's what it does.). you can chose a location and whether you want to create a separate directory for your project under selected hard-drive location.

How to create ssis project
Selecting  project template for SSIS using visual studio.




This opens a Package.dtsx file on visual editor. There are 2 sections on left, and 2 on right side of Editor which are:
  1. Variables: Here variables can be defined that can later used during execution of ETL or package. user should mention a appropriate scope for the variable defined.
  2. ToolBox: As normal toolbox control of visual studio, contains all the necessary tools to crate a package under SSIS
  3. Solution Explorer: Hierarchy of the folders of the current project.
  4. Properties: Shows available properties for selected module/component from editor.

There are also 4 tabs on editor window namely
  1. Control Flow: The main container where everything else resides.
  2. Data Flow: Data Flow is the main component when we have to transfer data.
Other than these there are 2 more: Event Handlers and Package Explorer(skip for now).

How to create package in ssis




Open Toolbox and double click 'Data Flow Task' or drag-drop it on editor window. This is the only task needed for this 'Simple Data Transfer' ETL Project. Double click on the 'Data Flow Task' in editor and it opens a editor for selected Data Flow Task.


How to create data flow task in ssis




Double Click the 'Data Flow Task'. Select 'OLE DB Source' from toolbox and drag it to editor. as we have to transfer the data from a SQL Server Database.
Note:
1. Flat File Source should be chosen when source is flat file.
2. Excel Source should be chosen when source is excel file. 

OLE DB Source in ssis





Double Click the 'OLE DB Source' component to configure it. Here click on 'Connection Manager' menu and select an available connection. If it seems empty in here and no connection is available then click on 'Cancel' button.
Ole DB Configuration SSIS





On 'Data Flow' editor, there is a 'Connection Manager' section at bottom. Right Click on this section and select 'New OLE DB Connection...'
SSIS | database connection using connection manager





This opens a 'Connection Manager' window. Select the server here and connect to a database selecting it from drop-down box. To log on to server either use windows Authentication or use SQL Server Authentication credentials of the user you are logging in with. Click 'OK'. This will create a new connection manager to connect with.

SSIS | Add new connection using connection manager






Now 'OLE DB Source' can be configured using this new connection. select the appropriate connection from list and say 'OK' pressing the button obviously :)

SSIS | ole db connection manager





Once done with setting-up the database connection for source, chose the table to extract data from.(Student in this case). Click 'OK' and we are done with 'OLE DB Source' configuration.

SSIS | ole db source editor





Now drag-drop a 'OLE DB Destination' component from toolbox on editor window, click on 'OLE DB Source' and connect the Green Line to 'OLE DB Destination.' And Configure the destination database same as we configured source database.(just select destination databse while you select database and not source)
SSIS | ole db destination editor






Now its the time to disco (mapping actually). Let us now map the columns of source and destination tables. Click on 'Mapping' menu in 'OLE DB Destination' configuration, and there will be 2 tables connecting by some links to appropriate columns.

SSIS  | Mapping





Click on the first link connecting IDs of both the tables and delete it. As we have defined ID column for tables as Identity it will get auto-generated value by itself.

SSIS | mapping tables





That's fine for now. We don't need so many configuration for this easy task. Save your package file and go to 'Control Flow' tab. Right click on 'Data Flow task' and click on 'Execute task'. This will execute the task and transfer the data from source table to destination table.

SSIS | Execute task from control flow





If it runs successfully(chances are 100% if your are following step by step ETL creation till now.), it will turn 'GREEN'.

SSIS | Executing package successfully




But if it turns 'RED' don't worry, there is a tab 'Execution Result'. This tab shows the progress of the package execution. If you get an error it will be shown here. Copy the error in a notepad and check the issue.
Execution tab SSIS






Or if you want you can also debug SSIS package using debugging events. Right click on 'Data Flow Task' and set debugging brake points.

SSIS | Debug breakpointa in ssis


Cheers and comment or share if this helps!!

Comments

Popular posts from this blog

Fake CVR Generator Denmark

What Is Danish CVR The Central Business Register (CVR) is the central register of the state with information on all Danish companies. Since 1999, the Central Business Register has been the authoritative register for current and historical basic data on all registered companies in Denmark. Data comes from the companies' own registrations on Virk Report. There is also information on associations and public authorities in the CVR. As of 2018, CVR also contains information on Greenlandic companies, associations and authorities. In CVR at Virk you can do single lookups, filtered searches, create extracts and subscriptions, and retrieve a wide range of company documents and transcripts. Generate Danish CVR For Test (Fake) Click the button below to generate the valid CVR number for Denmark. You can click multiple times to generate several numbers. These numbers can be used to Test your sofware application that uses CVR, or Testing CVR APIs that Danish Govt provide. Generate

How To Iterate Dictionary Object

Dictionary is a object that can store values in Key-Value pair. its just like a list, the only difference is: List can be iterate using index(0-n) but not the Dictionary . Generally when we try to iterate the dictionary we get below error: " Collection was modified; enumeration operation may not execute. " So How to parse a dictionary and modify its values?? To iterate dictionary we must loop through it's keys or key - value pair. Using keys

How To Append Data to HTML5 localStorage or sessionStorage?

The localStorage property allows you to access a local Storage object. localStorage is similar to sessionStorage. The only difference is that, while data stored in localStorage has no expiration time untill unless user deletes his cache, data stored in sessionStorage gets cleared when the originating window or tab get closed. These are new HTML5 objects and provide these methods to deal with it: The following snippet accesses the current domain's local Storage object and adds a data item to it using Storage.setItem() . localStorage.setItem('myFav', 'Taylor Swift'); or you can use the keyname directly as : localStorage.myFav = 'Taylor Swift'; To grab the value set in localStorage or sessionStorage, we can use localStorage.getItem("myFav"); or localStorage.myFav There's no append function for localStorage or sessionStorage objects. It's not hard to write one though.The simplest solution goes here: But we can kee