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.

No comments:

Post a Comment

Please use the SSIS MSDN forum for general SSIS questions that are not about this post. I'm a regular reader of that forum and will gladly answer those questions over there.

All comments are moderated manually to prevent spam.

Related Posts Plugin for WordPress, Blogger...