Bill Schanks
Bill Schanks

Reputation: 163

SSIS Float Data with extra decimals

Visual Studio 2015; Source: OLEDB (SQL2012); Dest: FlatFile (csv)

I have stored procedures that I need to pull data from, that I don't have control of, that have output of float data types. In SSMS the data looks something like 3.45985, but in SSIS the output csv file has the data like 3.45989999999 (The numbers are made up, but you get the point).

I do understand how float works, and understand that float is not a precise data type -- but I'm not in control of the stored procedure. Where I am struggling is how to work-around it. I've read that you can set the output to string in the flat file destination, but it doesn't seem to be working. I've also tried taking the output from the stored procedure and putting the results into a table variable and have had success formatting like I need. However some of the stored procedures already are doing some inserts into a temp table and when I try to store the results into a table variable I'm getting an error. So, that solution is really not working for me.

My business users are used to these being like 3.45985 in a legacy application. I'm re-writing these to all be done via SSIS to automate the extracts, and not have to support the legacy business line application.

Upvotes: 0

Views: 2559

Answers (1)

Chris Mack
Chris Mack

Reputation: 5208

You can use a Derived Column Transformation to round the number up and cast it as a decimal, with an expression such as:

(DT_DECIMAL, 5) ROUND([ColumnName], 5)

Upvotes: 2

Related Questions