sql-server-2008varcharmax

converting varchar(n) to varchar(max) on mssql2008


I have a table which has about 8,000 rows and I wanna change a column from varchar(1000) to varchar(max) I typed

alter table TABLENAME alter column COLUMNNAME varchar(MAX)

and it didn't work. How can I change the data type of the column? Or do I have to write varchar(5000) or something instead of varchar(MAX)?? Thank you.


Solution

  • The following thread here on SO contains answer to your question. Take note that your table might get dropped and re-created during the process.

    convert to varchar(max)