Lesson 4-4: Add a Flat File destination
The error output of the Lookup Currency Key transformation redirects any data rows that failed the lookup to the Script transformation operation. To provide more information about the errors that occurred, the Script transformation runs a script that gets each error's description.
In this task, you save all this information about the failed rows to a delimited text file for later processing. To save the failed rows, you add and configure a Flat File connection manager for the text file that contains the error data and a Flat File destination. By setting properties on the Flat File connection manager that the Flat File destination uses, you can specify how the Flat File destination formats and writes the text file. For more information, see Flat File connection manager and Flat File destination.
Add and configure a Flat File destination
Select the Data Flow tab.
In the SSIS Toolbox, expand Other Destinations, and drag Flat File Destination onto the data flow design surface. Put the Flat File Destination directly underneath the Get Error Description transformation.
Select the Get Error Description transformation, and then drag the blue arrow onto the new Flat File Destination.
On the Data Flow design surface, select the name Flat File Destination in the new Flat File Destination transformation, and change that name to Failed Rows.
Right-click the Failed Rows transformation, select Edit, and then in the Flat File Destination Editor, select New.
In the Flat File Format dialog box, verify that Delimited is selected, and then select OK.
In the Flat File Connection Manager Editor, in the Connection Manager Name box enter Error Data.
In the Flat File Connection Manager Editor dialog box, select Browse, and locate the folder in which to store the file.
In the Open dialog box, for File name, enter ErrorOutput.txt, and then select Open.
In the Flat File Connection Manager Editor dialog box, verify that Locale is English (United States) and Code page is 1252 (ANSI-Latin I).
In the options pane, select Columns.
In addition to the columns from the source data file, there are three new columns: ErrorCode, ErrorColumn, and ErrorDescription. These columns are the error output of the Lookup Currency Key transformation and the script in the Get Error Description transformation. You can use these columns to troubleshoot the cause of the failed row.
In the Flat File Destination Editor, clear the Overwrite data in the file check box.
Clearing this check box persists the errors over multiple package executions by appending each new run's error output.
In the Flat File Destination Editor, select Mappings to verify that all the columns are correct. Optionally, you can rename the columns in the destination.