Increase Length of Existing VARCHAR Column in SQL Server

SQL Server

Once you have created your table and filled it with data, it can be difficult to alter the table without losing your valuable data. You can increase the length of a VARCHAR column without losing existing data, but you will need to execute following ALTER TABLE statement.

Here is an example SQL command so you can se how  to increase the length of a VARCHAR column in SQL Server:

ALTER TABLE MyTable ALTER COLUMN MyColumn VARCHAR (100)

This command increases the length of MyColumn column of MyTable table to 100 characters. You can use the same command to increase the length of CHAR, NCHAR or NVARCHAR columns as well.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s