Implement error handling for data types in SSIS

When data is being moved from a source to a destination, there you may experience different types of issues related to the datatype errors and column data truncation. When column data coming from the source is bigger than the target column it is going into, SSIS fails the package. But the Error Output page in the For Data Flow tasks provides a way to tell SSIS how to handle either errors or column truncation for each individual columns. The three options are:

Ignore Failure Continues processing on error or truncating and disregard any errors
Redirect Row Sends the offending row out to the output
Fail Component Fails the task when an error or truncation occurs


















If you want to just send the error or truncated records to an error file or table, you can change the setting to Redirect Row. In this way, you can set up an error output destination.








In the case of column truncation, you have another option to handle the truncation warning if you know the truncation of certain columns will not be an issue. For example, if your target table has a column for State which is CHAR(2) and the source has a State column as VARCHAR(5), but you know that all States should be abbreviated to CHAR(2). In this case, you can change the length of the string being output from the Source Data adapter. You can do this by right-clicking the OLE DB Source adapter and selecting Show Advanced Editor from the shortcut menu.











This opens the Advanced Editor for OLE DB Source (Figure 2-105). Here you go to the Input and Output properties tab. In the left pane under Inputs and Outputs, open the Output Columns folder. The Output Columns displays all the columns and their attributes, which are being sent out of the source adapter to the next Data Flow task (this is after the data has been pulled into the source adapter). If you want to see the attributes of the columns at the source, you can open the External Columns folder.

Comments

Popular Posts

Install Master Data Services (MDS)

Non-blocking, semi-blocking, and blocking transforms in SSIS

Design an appropriate storage solution, including hardware, disk, and file layout