469,091 Members | 1,111 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,091 developers. It's quick & easy.

size limitation for dynamic SQl query

Dear all,

I'm trying to write a dynamic query and I need a local variable with 8000 chars long.

sql server forces me to use nvarchar of which max size is 4000:

Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.


And when I use ntext instead, I get this error:
The text, ntext, and image data types are invalid for local variables.

What else I can use?

May 11 '11 #1
2 4302
2,878 Expert 2GB
You can use VARCHAR(max). If really necessary, use multiple varchar variables and just do a:

Expand|Select|Wrap|Line Numbers
  2. exec (@var1 + @var2 + v@var3)
Happy Coding!!!

~~ CK
May 11 '11 #2
Thank you.
NVARCHAR(max) solved my problem.
May 11 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Pat | last post: by
1 post views Thread by Sharon | last post: by
2 posts views Thread by kalaivanan | last post: by
1 post views Thread by =?Utf-8?B?cGVsZWdrMQ==?= | last post: by
11 posts views Thread by julie.siebel | last post: by
2 posts views Thread by Mucahit ikiz | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.