Skip to main content
Jan 25, 2015

We hope that the examples below will help you if you want to change the size of a column in SQL.

Changing the size of a column with a SQL query

The syntax for changing the size of a column with SQL query is:

ALTER TABLE [table_name] ALTER COLUMN [column_name] [data_type]

For example, if a database contains a table "Students" with column "Name" that is nvarchar(10) and you want to change it to nvarchar(100) the following query will do the job:

ALTER TABLE Students ALTER COLUMN Name nvarchar(100)

Changing the size of a column in SQL Server with the Server Manager

1) Right-click on a table

2) Click on Design

3) Change datatype of column(s)

Changing the size of a column in MySQL

1) Login to phpMyAdmin and go to a database

2) Select table which field's length you want to change in the sidebar

3) Click Structure in the top menu

4) Click Change in Action column for field which varchar length you want to change

5) Set field Length/Values to desired value

6) Save the changes