An amount column is of Decimal(10,2) type. How to alter it to round-off to the next nearest figure? The situation is that I can't code it. Is there anyway that I can solve it by just changing the datatype of the column?
+2
A:
Update your column to another type, after change the column type, ex:
update table set column1 = cast(column1 AS SIGNED INTEGER)
Cesar
2009-11-13 10:30:58
A:
Sometimes altering the database is not an option. So here are some alternatives to making database structure changes.
You could use the format(X, D), round(X, D), or round(X) function in the select. All three functions work in the same manner.
May look something like this.
select format(column1, 0)
from table1
Check out the functions here
Berek Bryan
2009-11-13 10:51:28