472,111 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

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 4393
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.