How to import Data from SQL Server Table to Flat file (With Date) Using SSIS

In This tutorial, we are Going to learn how to import data from the SQL Server table into a flat file destination and Append the DATE TIME at the end of the filename.

STEP 1:- Create a new package and add a Data Flow Task






STEP 2:– Create a New OLE DB Connection (Source) and choose the database and table from which you want to Import data.




STEP 3:- Create a New Flat File Connection (Destination) and Double Click on the Flat File Destination Click on NEW then choose the Format as Delimited.




STEP 4:- In The next step you will be asked to Choose the path where you need your file to be Created, For now, you can Give the filename of your Choice which we can change later by using variables.




STEP 5:- In The Next Step We need to Create 3 Variables

Variable 1:- To Store the File Path.

Variable 2:- To Store the File Name

Variable 3:- To Store the Date Time Function which we will Append at the end of the Filename We will Create Data Time Expression in Detail.




STEP 6:- Click on Date time and start building the Expression as shown below.




STEP 7:- Right Click on the Flat File Connection and Click on Properties (1), Click on Expression and open the Property Expression Property Window (2), Choose Connection String from Drop Down (3), and Hit Expression (4) to start editing the expression.




STEP 8:- Add the three variables and click on evaluate Expression.

FILE PATH + FILENAME + DATETIME.




Post a Comment

0 Comments