Home Forums SQL Server 2008 T-SQL (SS2K8) SSIS ( cannot able to change datatype column using datatype conversion...... RE: SSIS ( cannot able to change datatype column using datatype conversion......

  • for example, convert string '$123456789' to money 1234567.89

    1. Use Data Coversion to convert '$123456789' to data type currency[DT_CY], it will be 123456789 in a new output alia after this step.

    2. Use Derived Column to change 123456789 to 123456789, just divided by 100. You need to make sure all values have two decimals. it generates a new column.

    3. Then you can insert the new column generated in step#2 into money column on destination table.

    you can also right click data source (ex. Flat File Source), Show Advanceded Editor -> Input and Output Properties - > Flat File Source Output -> Output Columns, to change the DataTypethe of the column to currency[DT_CY], so that you don't have to use Data Conversion. But I usually use it. It's up to you.

    If the value in text file has already has decimal, you don't have to use step #2.