Click here to Skip to main content
15,937,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to increase the data type of varchar(100) to varchar(200)?without any loss of data in the existing table?I am using MSSQL
Updated 20-Apr-11 21:33pm

yes you can do this by just altering your table like this,

Alter Table table_name
ALTER COLUMN col_name varchar(200)

For MY SQL :

ALTER TABLE table_name
MODIFY COLUMN col_name varchar(200)
Share this answer
Costica U 21-Apr-11 7:57am    
My 5. This is how I would do it.
You are increasing the size of a column, so you should not loose any data. Directly you can apply ALTER TABLE command.
But if your table contains a lot of data, than it will consume a lot of time.
So better idea to CREATE another clone table with column size of varchar(200) with some other name, Move all the data from main table to the new table, DROP the old table and RENAME the new table to main table.
Share this answer
Just go to table design and Change it or write ALTER TABLE query.

If you increase the size it will not affect any data. But, if you decrease the size there is a chance of losing the data.

This case no problem.
Share this answer
try this link

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900