SQL Server can't store more then 4000 characters in a local string variable

sql, sql-server, sql-server-2000

Solution

For anything not MSSQL 2005 or MSSQL 2008:

You can get 8000 in a `varchar(8000)`

Another option is to use a temporary table and populate that with the information you need. Use an autoindex to maintain order.

Problem

I tried to use text or ntext as the variable's type but they are disallowed. Is there a way to bypass this?

Original source