views:

165

answers:

3

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

+3  A: 
(n)varchar(max) will help you
Developer Art
that gives me an error: "Line 1: Incorrect syntax near 'max'."
the_drow
Because the 2000 does not support this. I just checked it in SSMS 2005 and it works nicely.
Developer Art
+3  A: 

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.

ck
+1 for pre sql server 2005
Robin Day
I tried to create a temporary table but it doesn't really work, any suggestions? I can't concat text fields for some reason
the_drow
+3  A: 

TEXT and NTEXT are being deprecated in a future version of SQL Server.

Instead, you should be looking to use VARCHAR(MAX) and NVARCHAR(MAX) which remove the previous 8000 and 4000 size limits respectively, taking you up to 2^31-1 bytes.

AdaTheDev