Creating a Corrupted File
In order to demonstrate the configuration and handling of transformation errors, you will have to create a sample flat file that when processed causes a component to fail.
In this task, you will create a copy of an existing sample flat file. You will then open the file in Notepad and edit the CurrencyID column to ensure that it will fail to produce a match during the transformations lookup. When the new file is processed, the lookup failure will cause the Currency Key Lookup transformation to fail and therefore fail the rest of the package. After you have created the corrupted sample file, you will run the package to view the package failure.
In Notepad or any other text editor, open the Currency_VEB.txt file.
By default, the Currency_VEB.txt file is installed in the folder c:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Tutorial\Creating a Simple ETL Package\Sample Data.
Use the text editor's find and replace feature to find all instances of VEB and replace them with BAD.
In the same folder as the other sample data files, save the modified file as Currency_BAD.txt.
Important: Make sure that Currency_BAD.txt is saved to the c:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Tutorial\Creating a Simple ETL Package\Sample Data folder.
Close your text editor.
On the Debug menu, click Start Debugging.
On the third iteration of the data flow, the Lookup Currency Key transformation tries to process the Currency_BAD.txt file, and the transformation will fail. The failure of the transformation will cause the whole package to fail.
On the Debug menu, click Stop Debugging.
On the design surface, click the Execution Results tab.
Browse through the log and verify that the following unhandled error occurred:
[Lookup Currency Key] Error: Row yielded no match during lookup.
Note: The number 30 is the ID of the component. This value is assigned when you build the data flow, and the value in your package may be different.