#1
  1. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Location
    Brisbane, Australia
    Posts
    1,442
    Rep Power
    29

    Converting a table datatype from float to decimal


    I want to switch a data type in a table from float to decimal to get rid of some evil rounding errors. How do i do it without rounding all the values to whole numbers? I'm using enterprise manager to edit my tables.

    Tah,
    Pete
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    21
    Rep Power
    0
    never tried, but if simply changing the datatype to decimal rounds everything off to whole numbers, i would create a new table, delete the old table and then rename the new one to match the old one... may not be the best way but it should work.

    select column1, column2, convert(decimal(5,2), column3)
    into newtable
    from oldtable

IMN logo majestic logo threadwatch logo seochat tools logo