Wednesday, March 7, 2012

Decimal Formatting from OLEDB Source to Flat File

I have a

table with column (call it Rate) defined as decimal(18,4). This column

can have any positive decimal value. When the value is less than 1

(e.g. 0.1234) strange things are happening in SSIS.

To set the scenario ...

If I do a select in Management Studio, the value is correctly displayed as 0.1234

If I do the same select from the command line via OSQL, I get .1234

If I do SELECT CONVERT(char(6), Rate) from OSQL, I get 0.1234 (which is what I want)

In SSIS I have an OLE DB Source which defines the SELECT statement to use, and that maps straight to a Flat File Destination.

The

default column type in the flat file connection manager is DT_NUMERIC,

Precision 18, Scale 4. I Set InputColumnWidth to 6 as that's how I need

it in the flat file. The value appears in the file as .1234

I

change the SELECT in the OLEDB Source to apply the CONVERT(char(6),

Rate), and change the column type in the connection manager to DT_STR

length 6. Output is *still* .1234

How can I get the output column in my file to show 0.1234 ?

Greg.
Restarting this thread to check for any new information.

Greg.|||have u tried Currency datatype|||Yes. It made no difference.

Greg.

No comments:

Post a Comment