Wednesday, January 20, 2016

Excel file upload to the sql server table by using SSIS

Let’s start with creating a small package in SSIS
We will start creating small project which loads data from source flat file to destination SQL Server database. here i have written few ways to load data. There may other ways that would be discussed later in our tutorials
  1. Import And export wizard (32 bit/64 bit)
  2. SSIS package
Loading data from excel/flat file to sql server:-
  1. Open SSDT press Ctrl+Shift+N (or) Select New Project Solution from File menu.
  2. You find  options to create a project

  1. Name your project. Whenever you create a project a solution file will be created in location folder c:\users\xxxx\documents\visual studio 2010\Projects. Click ok
  2. Go to ssis tool box drag data flow transformation from the tool box. And double click on it you will automatically entered into Control flow pane

  1. After entering into the Control flow  Drag excel source and flat file transformations from the control flow

  1. Here we are using two sources to load data into destination. So the column name should be same in both sources
  2. Select flat file and excel file which you want load into SQL server.

  1. Click on new and select create the connection excel file as show above picture
  2. Go browse and select the excel file where you stored

  1. Click ok and select name of the excel sheet. As 1st page of excel xxxx$

  1. Go to columns and click ok. You can check preview also. Next configure  Flat File source

  1. Click on new  create new flat file connection

  1. Click on browse select Flat file you want to load go to columns and click ok.
  2. Remember you must go to columns tab otherwise you can’t map the inputs to the outputs
  3. we are using merge join transformation to merge flat file and excel file

  1. before configuring merge join we need to set the property    IsSort to true for both transformations

17. Right click on the excel source go to show advanced editor

  1. go to input and output properties  click on external source output on the right pane you will find Is Sorted Propertie make it true and set out put orders of the columns id,ename,salary

  1. Set orders of the output columns  do same process for flat file also

  1. After setting both transformations sort key orders drag merge transformation

  1. Take one ole db. destination save and execute the package.
  2. For excel File loading Right click on the package go to debugging Run64bitruntime :false
  3. Press F5 to debug.

Check SQL SERVER table for loaded data