locked
Converting Number to float RRS feed

  • Question

  • Hi,

    I am creating an SSIS package, My source DB is ORACLE and destination is SQL Server 2008.

    I geeting number filed from oracle and i want to change the number  to  float.

     

    like   1 in oracle ------> 1.0 in sql

    how can i achive this.

    i tried with data converion but not sucess.

    plz let me know the solution

    Sunday, November 6, 2011 7:48 AM

Answers

  • Do not use float as it is approximately calculation, instead use DECIMAL,

    SELECT CAST(1 AS FLOAT)

    1


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Marked as answer by Eileen Zhao Friday, November 11, 2011 7:59 AM
    Sunday, November 6, 2011 8:39 AM
  • you can also change data types with Data Conversion Transformation in SSIS Data Flow task
    http://www.rad.pasfu.com
    • Marked as answer by Eileen Zhao Friday, November 11, 2011 7:59 AM
    Sunday, November 6, 2011 11:20 AM

All replies

  • SELECT CAST(1 AS DECIMAL(5,1))
    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Sunday, November 6, 2011 7:50 AM
  • HAI,

    Uri Thanks for ur replay.....

    can we use float insted of decimal

    Sunday, November 6, 2011 8:10 AM
  • Do not use float as it is approximately calculation, instead use DECIMAL,

    SELECT CAST(1 AS FLOAT)

    1


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Marked as answer by Eileen Zhao Friday, November 11, 2011 7:59 AM
    Sunday, November 6, 2011 8:39 AM
  • you can also change data types with Data Conversion Transformation in SSIS Data Flow task
    http://www.rad.pasfu.com
    • Marked as answer by Eileen Zhao Friday, November 11, 2011 7:59 AM
    Sunday, November 6, 2011 11:20 AM