Problem With Exporting Float Data
I am exporting float data from a table to a flat file with SSIS package. But the data is written like 0.5000000000000001, but I just want to keep only 2 or 3 digits after the decimal point. Please let me know how to achieve this using format delimited in flat file connection manager. Thanks.
March 25th, 2011 4:45pm

Do you want to round the number, too? If just to trim: 1) Add a Data Conversion Task to after the data source, and 2) Convert the number to string of a certain length, trimming it at the same time. If you need help in the latter case with the SSIS expression let us know.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2011 4:57pm

You can convert the float to the DT_NUMERIC data type in the Data Conversion Task. There you can specify precision and scale. @ArthurZ: the Data Conversion Task doesn't have expressions. Don't you mean the Derived Column ;) (which can also be used to convert the value)
March 25th, 2011 5:18pm

I actually tried to set the scale and precision in the flat file connection manager, but it didn't work, I thought the conversion would be done automatically according to the properties given for the destination. I will try to use data conversion task now. Thanks.
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2011 5:34pm

I used a data conversion task and converted the data to DT_NUMERIC data type with scale, 2, and also set the data type for target columns in the connection manager as DT_NUMERIC, but still it didn't work. Have I missed anything? Thanks.
March 25th, 2011 5:43pm

Are you sure you mapped the new converted column in the destination adaptor? The data conversion component doesn't change the value in the column, it rather creates a new column with the converted value.
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2011 5:45pm

Yes that was the problem. It worked finally. Thank you all for your replies.
March 25th, 2011 5:48pm

You need to do this as an expression like that: (DT_WSTR,20)(DT_NUMERIC,20,2)(YourNumericValue) Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
March 25th, 2011 5:54pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics