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?
You can modify the data type of a column in SQL Server by using SQL Server Management Studio or Transact-SQL. Modifying the data type of a column that already contains data can result in the permanent loss of data when the existing data is converted to the new type.
Change data types in Datasheet view Access opens the table in Datasheet view. Select the field (the column) that you want to change. On the Fields tab, in the Properties group, click the arrow in the drop-down list next to Data Type, and then select a data type. Save your changes.
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table. The ALTER TABLE statement is also used to add and drop various constraints on an existing table.
Which DBMS are you using ? you can try like this for MySQL :
alter table tblName modify columnName newDataType;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With