Description:-
So, let’s start with simplest
one transformation control which is “Sort”.
By the name it is clear data
it will sort the data which is
provided to it and give sorted output as a result. Let’s understand this by
below step by step example. (Here I am not writing step to start visual studio
and create a new project, I am pretty much sure you are aware of this now.)
Before going further let me
tell you want we are going to do here. We will have an input result (which
will be a text file) and then sort it and save in another file.
Step 1:-I renamed package to SortPackageDFT if you want you can
rename your package as well. Now drag drop a Data Flow task as
shown below and double click DATA flow task
Step 2:- When you click it you
will get a data flow screen where you can drag
drop FLAT file source. You can choose source assistance as well.
Now configure this flat file source. Means give the path of the file which you
want to have as an input source. I am taking a text file which contain fruits name
in different order. As shown in below figure.
Right click flat file source click on EDIT option and
follow the screens
Step 3:- Now once the file is configure. We have
to drag drop SORT control from SSIS tool box as
shown in below figure.
I also added the output of
flat file source to sort control. As shown in above figure. Now configure it.
Click on Sort control and you will get following screen. As show in below
screen you can sort the data on any column and in any direction like Ascending
or descending.
Right there is only one input
column which is name so we are sorting name in ascending order as shown below. You also can remove duplicate rows
from the source file and store in distinct rows in destination file by check
mark in the Sort Transformation Editor
screen like below.
Step 4:- Now once this configuration is done we will save
the data in new file with new name which will be SortedCustomer. Now to achieve this drag drop the destination control. So I took
same float file destination as shown in below figure
Step 5:- Now configure this
file destination. Which means where we need to save this file and what are the
columns which we required. So In current case there is only one column which is
Name (Fruit name) and I am saving this file at same place with SortedCustomer name. So let’s configure
it by clicking right click on flat file destination and click on edit button.
Step 6:- Once this is configured we need to run this
package by pressing F5.When you run hit F5 and everything going right then in
execution screen at each step you will find green right check image as shown in
below screen.
Step 7: Now to cross check we will first see whether that
file is created or not. If created then whether we have sorted data or not. So
let’s open the flat files.
So, if you see at provided destination location a file is
created and the data inside this file is sorted file.
Thanks for comments.....