SSIS output to flat file as 0.00

In SSIS, I have a MONEY column in my OLE DB source that is formatted as 0.00. I want to output this value to a flat file in exactly the same format. So far I have found two solutions:

  • Convert this to a string in my source and output the string to a file. Since this is a flat file, I don't care HOW I got to 0.00. He just uses it as meaning.

  • Use a derived column in your data stream to generate a row with 0.00. This is just a tricky way to achieve the first solution, but it can work in situations where I have no control over the format of the original data.

I don't like any of these solutions as it requires some extra work to do the formatting of the string. I can get the data to output to .00 if I change the output column of the dataflow source to numeric (18,2), but that doesn't completely solve the problem. Is there a way to output 0.00 without converting the data to a string?

+1


a source to share


1 answer


Use the regex ABS (). It remains numeric and produces the "0.00" you want.

ABS(numeric_expression)

      



** take a look at math regular expressions. The ABS may not be what you want if you have negative values ​​in the original data.

+2


a source







All Articles