I'm having an issue that apparenlty the entire internet can't solve. I wanted to create a new thread so I can summarize the problem with all the current findings. This is a known issue but for some reason I'm special and the suggested solution doesn't seem to work. Here is the issue: I need money values from a database to print properly on a ragged right flat file: 000.00.
The intial problem was any values that had zero cents were getting printed without the cents value. 123.00 became 123. Values that were 0 weren't printed at all. I solved this by doing the following:
On the OLE DB Source I right click and go to the advanced editor. In the Input and Output properties I go to OLE DB Source Output and expand output columns. I click on the column I want and change the data type to DT_NUMERIC with precision 12 and scale 2. That makes NO sense but it works.
So now I'm getting ALMOST what I need. The problem NOW is values that are 0 get printed as .00 with no leading 0. That just looks freaking weird.
At this point the suggestion from the community is to create a derived column. Makes sense right? So I do that with the following expression:
(DT_STR,50,1252)([BALANCE] == 0 ? "0.00" : (DT_STR,50,1252)[BALANCE])
Now that's pretty straight forward. Check the column value and change the output to 0.00 if the amount is 0. If it's not 0 use the exising value and cast it to string. Then cast the entire thing to string. This doesn't work. Zero values are still coming out on the flat file as .00.
The final piece of this is the flat file connector. I've experimented with different data types on the flat file; both string and numeric. Neither one makes a bit a difference.
Does anybody have any idea what on earth is going on here?