May 6, 2009 at 5:25 am
Hi ,
I am using a store procedure where i am creating a query dynamic , but query size is increasing the limit of varchar(8000) size , how i can use the data type text in the store procedure to store the created query and then run using the command Exec(@query)
I tried declaring it using the method below :
DECLARE @Query text(16000)
but giving me the error below :
Msg 131, Level 15, State 3, Procedure csplitsubtable_loop, Line 11
The size (16000) given to the type 'text' exceeds the maximum allowed for any data type (8000).
May 6, 2009 at 5:37 am
Hi,
text datatype can have maximum length of 8000.
I think you should break your dynamic query into 2-3 parts.
May 6, 2009 at 6:15 am
You cannot specify a column width on data type text.
Failing to plan is Planning to fail
May 6, 2009 at 6:34 am
nvarchar(max)
solved my purpose , thanks a lot !
May 6, 2009 at 7:11 am
pushpa.kumari (5/6/2009)
Hi,text datatype can have maximum length of 8000.
I think you should break your dynamic query into 2-3 parts.
Text doesn't actually have a limit that low. Large Objects, LOB or BLOB for the binary large objects, are stored on disk, seperate from the table. However, use of the BLOB types are discouraged in 2005/2008.
The OP found the right answer, using VARCHAR(MAX) is the way to go. If you were working with a binary it would be VARBINARY (MAX).
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply