Tuesday, May 12, 2015

Loading excel and text file to the OLEDB destination

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. We included few ways to load data. There may other ways that would be discussed later in our tutorials
1.       Import And export wizard (32bit/64bit)
2.       SSIS package
Loading data from excel/flat file to sql server:-
3.       Open SSDT press Ctrl+Shift+N (or) Select New Project Solution from File menu.

4.       You find  options to create a project 
a     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

5.       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
6.       After entering into the Control flow  Drag excel source and flat file transformations from the control flow

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

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

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

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

13.       Click on new  create new flat file connection

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

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

18. Right click on the excel source go to show advance editor 

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

20.  set orders of the output columns  do same process for flat file also

21.       after setting both transformations sort key orders  drag  merge transformation

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

Check SQL SERVER table for loaded data

Expression Error In Derived Column

How to resolve Expression Error IN Derived column

Expression Error In Derived Column

Change data types in Show Advance editor of Source transformation which causes error. Right click and go to Show Advance editor and go to tab Input and output properties. Select excel source properties and drill down the columns select the column which you want Under Data type properties change the data type. Here above picture indicating that data type that is DT_DATE (DATE) and DT_WSTR (STRING) miss match.  Whatever the data types coming from the source u need to use those data types in sequential transformations. Then only you won’t get these type of errors.