Monday 20 August 2012

FLAT FILE TO FLAT FILE DATA TRANSFER



Requirement:
I have a flat file in source location (E:\Kiran\Source\Sample.txt) with two fields ‘ID and Name’ shown in below screen shot.


With the help source file data we need to create new flat file in target location (E:\Kiran\Target\)

Package creation:
  • In control flow items (from tool box) drag “Data flow task” and drop into the designer surface.

  • Right click on data flow task and select edit option. Then it will go to data flow.
  • In data flow items drag and drop Flat file source. Right click on flat file source and select edit option. Then flat file source editor window will open.


  • In “flat file source editor” window choose “New flat file connection manager” option to create connection for source.
  • Then “Flat File Connection Manager Editor” window will open.
  • We need to give connection manager name and source file path, shown below.
  • If source file is having header information (Column names) choose the option “Column names in the first data row”.


  • In “Flat File Connection Manager Editor” window choose “Columns” option and select “OK” option.


  • Then it will come to “Flat file connection manager editor” window, select “Columns” option and verify column names and select “OK” option. See the below screen shot.



  • Now the source connection is finished we can see the connection information in “Connection manager” window shown below.



  • Go to tool box, in the “Data flow destinations” list drag and drop “Flat file destination”.
  • Select “flat file source” then two arrows will come one is green and other one is red. Click on green arrow and attach the arrow to “flat file destination” shown below. 


  • Target connection is not completed due to that “Red cross” is present in “Flat file target”
  • Right click on “flat file destination” and select edit option then “Flat file destination editor will open.
  • Create new connection for destination and choose the file type (Delimited, Fixed width, Fixed width with delimited or ragged right) then give destination file name and path.


  • Select “Columns” option and click “OK”. Then it will go to “Flat file Destination editor”.
  • Choose “Columns” option and make sure all columns are mapped properly and choose “OK” shown below.


  • Source and target connection are finished.
  • Now package is ready for execution.
  • Right click on the package and select “Execute package” option show below.




No comments:

Post a Comment