I’ve inherited a asp.net website project that currently runs SQL Server 2000 as its backend.
I’ve been doing some databases changes on a local copy of the db using SQL Server 2005 Express. I’ve create a table using varchar(max) columns. They are used to stored snippets of XHTML that are of arbitrary length.
While browsing around on stackoverflow I came across this: Are there any disadvantages to always using nvarchar(MAX)?
User mattruma says he found out the ‘hard way’ about using varchar(max) on SQL Server 2000.
What should I use instead of varchar(max) given that the live database runs on SQL Server 2000?
Thanks in advance for any help!
It sounds like the
varchar(MAX)limitations are a moot point if your live DB is SQL Server 2000, which doesn’t support them. If you have more than 8K characters to store you are pretty much left with the only other option, aTEXTcolumn. However, beware thatTEXTcolumns have a lot of limitations too.For example you can’t sort or group on them easily, nor can you compare them for equivalency with other columns. That is you can’t say
Select * from mytable where Mytext1 = mytext2.Other relevant concerns:
NTextorNVarcharcolumn regardless of the way you go to support Unicode.varchar(8000)column is likely to be frequently close to full, you may have problems with the row limit of 8K. Keep this in mind too.