Task 4: Adding a Flat File Destination

The error output of the Lookup Currency Key transformation redirects to the Script transformation any data rows that failed the lookup operation. To enhance information about the errors that occurred, the Script transformation runs a script that gets the description of errors.

In this task, you will save all this information about the failed rows to a delimited file for later processing. To save the failed rows, you must add and configure a Flat File connection manager for the text file that will contain 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.

To add and configure a Flat File destination

  1. Click the Data Flow tab.

  2. In the Toolbox, expand Data Flow Destinations, and drag Flat File Destination onto the data flow design surface. Put the Flat File Destination directly underneath the Get Error Description transformation.

  3. Click the Get Error Description transformation, and then drag the green arrow onto the new Flat File Destination.

  4. On the Data Flow design surface, click Flat File Destination in the newly added Flat File Destination transformation, and change the name to Failed Rows.

  5. Right-click the Failed Rows transformation, click Edit, and then in the Flat File Destination Editor, click New.

  6. In the Flat File Format dialog box, verify that Delimited is selected, and then click OK.

  7. In the Flat File Connection Manager Editor, in the Connection Manager Name box type Error Data.

  8. In the Flat File Connection Manager Editor dialog box, click Browse, and locate the folder in which to store the file.

  9. In the Open dialog box, for File name, type ErrorOutput.txt, and then click Open.

  10. In the Flat File Connection Manager Editor dialog box, verify that the Locale box contains English (United States) and Code page contains 1252 (ANSI -Latin I).

  11. In the options pane, click Columns.

    Notice that, in addition to the columns from the source data file, three new columns are present: ErrorCode, ErrorColumn, and ErrorDescription. These columns are generated by the error output of the Lookup Currency Key transformation and by the script in the Get Error Description transformation, and can be used to troubleshoot the cause of the failed row.

  12. Click OK.

  13. 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.

  14. In the Flat File Destination Editor, click Mappings to verify that all the columns are correct. Optionally, you can rename the columns in the destination.

  15. Click OK.

Next Task in Lesson

Task 5: Testing the Lesson 5 Tutorial Package

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.