Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Altering column size in SQL Server

How to change the column size of the salary column in the employee table from numeric(18,0) to numeric(22,5)

like image 722
Sree Avatar asked Apr 13 '12 09:04

Sree


People also ask

How do I change the size of a column in SQL Server?

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.

How do you reduce the size of a column in SQL Server?

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.

How do you change the size of a column in a database?

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.

Can we reduce the column size in SQL?

it is not possible to decrease the size of column. same table it is not possible.


1 Answers

ALTER TABLE [Employee] ALTER COLUMN [Salary] NUMERIC(22,5) NOT NULL 
like image 173
Darren Avatar answered Sep 19 '22 09:09

Darren