How can I modify an existing column's data type?

oxo picture oxo · Nov 29, 2011 · Viewed 9.4k times · Source

One of the columns in a somewhat large table (~10,000 records) is of the data type DECIMAL(10,0). I'm using MySQL.

I'd like the values to be displayed to 2 decimal places, so I need to alter this to DECIMAL(10,2), without screwing up the table's existing records. How could this be done?

Answer

gprathour picture gprathour · Nov 29, 2011

Which DBMS are you using ? you can try like this for MySQL :

alter table tblName modify columnName newDataType;