In SSIS (2016) I'm reading a flatfile and converting a field containing decimals in a Swedish format ("0,5" - "1,22" etc) to DT_Decimal (with a scale of 2), resulting in 0.5, 1.22 as expected. However the source contains one misplaced value - "84.717.050". An error is produced ("The data value cannot be converted for reasons other than sign mismatch or data overflow.") when this value is encountered, and it can be redirected fine as an erroneous row in the dataflow. This is on my local client or development machine in Visual Studio, with Swedish region and regional formatting. Additionally, the package, connection manager, dataflow and flat file source are all set to LocaleID Swedish (Sweden).
The package is then deployed and executed on a server - where the service account executing the package through SQL Server Agent is set to Danish region and regional formatting. Here, the value "84.717.050" does not produce an error, instead it is converted to 84717050. This causes a problem later on in the destination as this is not an expected value.
The same behaviour is encountered if I change the Regional format to Danish on my machine, and execute the package in Visual Studio. The error is no longer produced when the value, "84.717.050", is encountered.
Experimenting and simplifying further, I created an expression task (with Swedish LocaleID in SSIS) with this formula:
(DT_DECIMAL, 2)"84.717.050"
This is producing 84717050,00 when using Danish Regional settings in Windows, but throws "Error code 0x80020005 occurred attempting to convert from data type DT_WSTR to data type DT_DECIMAL." with Swedish Regional settings.
I would assume that the LocaleID in SSIS should affect how decimals are interpreted, but instead the Windows Regional format setting seems to be used in this case. Is this really the correct and expected behaviour?