user3548593
user3548593

Reputation: 499

How to convert string to float in ssis

How to convert the column Quantite in float in SSIS ?

enter image description here

Upvotes: 0

Views: 1869

Answers (1)

aghost
aghost

Reputation: 192

I will try to put it simple, assuming you are familiar with SSIS and Script Components

Main problem is that your column contains leading 0's that makes it harder to parse the value to float.

Solution 1

You will first need to get rid of the leading 0's using a Derived Column component with fitting expression (could be complex)

Then pass that column through a data conversion component and set the data type to float

Solution 2

Pass original column through a script transform component, remove leading 0's and parse it to a new float column in the ProcessInputRow method using .NET

C# Example:

Row.new_column = float.Parse(Row.Quantite.TrimStart('0'));

Upvotes: 1

Related Questions