如何将员工表中工资列的列大小从数字(18,0)更改为数字(22,5)
当前回答
alter table Employee alter column salary numeric(22,5)
其他回答
对于Oracle数据库:
VARCHAR2(255 CHAR);
有趣的方法可以在这里找到:如何扩大你的专栏没有停机由spaghettidba
If you try to enlarge this column with a straight “ALTER TABLE” command, you will have to wait for SQLServer to go through all the rows and write the new data type ALTER TABLE tab_name ALTER COLUMN col_name new_larger_data_type; To overcome this inconvenience, there is a magic column enlargement pill that your table can take, and it’s called Row Compression. (...) With Row Compression, your fixed size columns can use only the space needed by the smallest data type where the actual data fits.
当表在ROW级别被压缩时,ALTER table ALTER COLUMN是仅元数据的操作。
ALTER TABLE "Employee" MODIFY ("Salary" NUMERIC(2,5));
ALTER TABLE [Employee]
ALTER COLUMN [Salary] NUMERIC(22,5) NOT NULL
alter table Employee alter column salary numeric(22,5)