2012年3月21日星期三

Flat File Connection Manager does NOT fail

I use Flat File connection manager where I have defined the format of the file as "Ragged Right" (CR,LF Dos file) with no header rows. The columns are fixed width with Row Delimiter "{CR}{LF}".

The problem is when I process a file with incorrect format. The file execution does not throw an error. Instead it throws a warning " There is a partial row at the end of the file.".

How can I force the Flat file connection manager to FAIL if the format of the file is not matched exactly. I would think this would be the default behavior of Connection manager.

ie. If I have Connection manager setup for a dos file with 2 columns. Column 1 is 5 characters long, column 2 is 3 character long, and the end of line characters are CR, LF. However, if I send in file with 10 rows of 1 character and CR LF, the data flow works and processes these rows incorrectly. How can I force the task to fail if incoming file is not in defined format.

The "Ragged Right" format does not have any limitation on the size of the last column (delimited one), so if your file is missing some row delimiters the flat file parser will continue to look for them and probably swallow succeeding row(s).

You can restrict the size of your "ragged right" column by setting the OutputColumnWidth property of those columns on the Advanced page of the Flat File Connection Manager UI. That will make the flat file source fail if the truncation happens. If you would rather to redirect such rows, you can do that by setting "Redirect Row" for Truncation on the Error Output page of the Flat File Source UI, and then define your error flow.

HTH.|||Thanks. It worked.

没有评论:

发表评论