Varchar(255) to Varchar(MAX)

Darbio picture Darbio · Apr 23, 2010 · Viewed 58.8k times · Source

Is it possible to change a column type in a SQL Server 2008 database from varchar(255) to varchar(MAX) without having to drop the table and recreate?

SQL Server Management Studio throws me an error every time I try to do it using that - but to save myself a headache would be nice to know if I can change the type without having to DROP and CREATE.

Thanks

Answer

Adriaan Stander picture Adriaan Stander · Apr 23, 2010

You should be able to do it using TSQL.

Something like

ALTER TABLE [table] ALTER COLUMN [column] VARCHAR(MAX)