Wednesday, 31 December 2014

Add trailing zeros

I have a currency €25,10 but when I put it in a Flat File destination it removes all trailing zero's after the decimal symbol: 25,10 becomes 25,1 and 24,00 becomes 24. How can I prevent that?

The solution is easy. Just cast it to a numeric with the scale set to 2. Other datatypes remove the trailing zeros, but numeric seems to do the trick: (DT_NUMERIC,5,2)myNumber
CAST to get trailing zeros

For adding leading zero check this post.
Related Posts Plugin for WordPress, Blogger...