SSIS FLAT FILE Destination

The SSIS FLAT FILE Destination is used to write data to a text file present in the File System. The text file can be in fixed width, delimited, ragged right, or fixed width with a row delimiter.

NOTE: The SSIS FLAT FILE Destination uses a Flat File Connection Manager to create connections with files.

Configuring SSIS Flat File Destination

STEP 1: Drag and drop the data flow task from the toolbox to control flow and rename it to SSIS FLAT FILE Destination.

Data flow task 1

Double click on it will open the SSIS data flow tab.

STEP 2: Drag and drop OLE DB Source and Flat File destination onto the data flow region. In this example, we will explain only about Flat File destination, so please refer to the OLE DB Source article. For more information on data Loading >> Click Here.

SSIS FLAT FILE Destination 2

Double click on Flat File Destination in the data flow region will open the Flat File Destination Editor to configure the connection manager settings. If you haven’t created Flat File Connection Manager before, click on the New button and configure it.

SSIS FLAT FILE Destination Editor 3

Once you click on the New button, the Flat File Format window will open. It provides four options: Delimited, Fixed Width, Fixed Width with row delimiters, and ragged right. For this example, we are selecting the Delimited option, but Please choose the option you want to use and click the OK button.

Choose Format - Delimited, fixed width, ragged right 4

Once you click the OK button, a new window called Flat File Connection Manager Editor opens. Here, click the Browse button to traverse the file system and locate the required file. If you select the Existing File option, choose from the file system; otherwise, create one. Here, we select the existing file.

Choose txt from file system 5

Once you select the file, we have to specify whether our text file holds column names in the first row or not by check-marking Column names in the first data row option. Since our flat file contains the column names in the first row, we check-mark the option. If your text file is different, then don’t select it.

SSIS FLAT FILE Destination 6

Format: Here, you can select the Format you want to use while writing data to the text file.

Choose the Format from Delimited, fixed width, and ragged right 7

Header Row Delimiter: Please select the header row delimiter

SSIS FLAT FILE Destination 8

Let us check the data by visiting the Columns Tab in the Flat File Connection Manager

SSIS FLAT FILE Destination 9

Click on the preview button to see the data preview.

Click Preview button to see data view 10

Next, please click the Mappings tab to check whether the source columns are mapped exactly to the destination columns.

SSIS FLAT FILE Destination 11

Click OK to finish configuring the SSIS Flat File destination package. Let us run and see whether we successfully transferred the SQL table rows into the flat file or not.

SSIS FLAT FILE Destination 12

From the below screenshot, you can observe that we transferred the SQL table rows into the SSIS flat file destination text file.

Final txt file 13