Helpful Information
 
 
Category: MS SQL Development
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

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










privacy (GDPR)