Why package is not throwing an exception?
This is normal, you are reading the Flat file Source as a fixed width columns, (Fixed width or Ragged right) with the following specifications.
"Ragged Right", which is exactly the same as "Fixed Width", except that it gives you the option to insert a linefeed character (or CRLF, etc.) at the end of each line of data.
(You can check the Flat File connection manager to see the specifications)
Initial State
Data:
0001aijn fkds jmcl wuj
Specifications and Result :
Col001: From 0 -> 3 '0001'
Col002: From 4 -> 7 'aijn'
Col003: From 8 -> 11 ' fkd'
Col004: From 12 -> 13 's '
Col005: From 14 -> 18 'jmcl '
Col006: From 19 -> end 'wuj'
Second State
So when you added a S
character the data looks like:
0001aijns fkds jmcl wuj
Specifications and Result :
Col001: From 0 -> 3 '0001'
Col002: From 4 -> 7 'aijn'
Col003: From 8 -> 11 's fk'
Col004: From 12 -> 13 'ds'
Col005: From 14 -> 18 ' jmcl'
Col006: From 19 -> end ' wuj'
For more informations:
Is there any work around...where it can throw error in such case?
- In the Flat File Connection manager use the
Delimited Format
- Go To the Advanced Tab, Delete all Columns Except one column
- Change the Datatype to
DT_WSTR
and the length to 4000
- In the Data Flow Task add a Flat File Source, Conditional Split, Script Component, Derived Column Transformation, OLEDB Destination as Shown in the image below

Use the Conditional Split to filter rows based on the length of the column:
LEN([Column0]) == 22

In the Script Component write the Following Code (used to raise error if there is a row of length > 22):
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Throw New Exception("Length constraint violated")
End Sub
Specify the following Derived Columns

- Map the result to the
OLEDB Destination