How to change the column size of the salary
column in the employee
table from numeric(18,0)
to numeric(22,5)
In this case, you need to use ALTER TABLE statement to increase column size. ALTER TABLE table_name MODIFY column_name varchar(new_length); In the above command, you need to specify table_name whose column you want to modify, column_name of column whose length you want to change, and new_length, new size number.
If you want to reduce the size of column that already has data larger than you want to make it you need to update the column first with the "truncated" value; then alter the column.
In generic terms, you use the ALTER TABLE command followed by the table name, then the MODIFY command followed by the column name and new type and size. Here is an example: ALTER TABLE tablename MODIFY columnname VARCHAR(20) ; The maximum width of the column is determined by the number in parentheses.
it is not possible to decrease the size of column. same table it is not possible.
ALTER TABLE [Employee] ALTER COLUMN [Salary] NUMERIC(22,5) NOT NULL
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