Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
T-SQL (SS2K5)
»
how can i use declare text in sql store...
how can i use declare text in sql store procedure
Rate Topic
Display Mode
Topic Options
Author
Message
solutionsdxb
solutionsdxb
Posted Wednesday, May 06, 2009 5:25 AM
Forum Newbie
Group: General Forum Members
Last Login: Sunday, January 10, 2010 12:19 AM
Points: 8,
Visits: 46
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).
Post #710944
pushpa.kumari
pushpa.kumari
Posted Wednesday, May 06, 2009 5:37 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Friday, June 10, 2011 6:11 AM
Points: 121,
Visits: 93
Hi,
text datatype can have maximum length of 8000.
I think you should break your dynamic query into 2-3 parts.
Post #710950
Madhivanan-208264
Madhivanan-208264
Posted Wednesday, May 06, 2009 6:15 AM
Old Hand
Group: General Forum Members
Last Login: Wednesday, September 12, 2012 5:17 AM
Points: 329,
Visits: 461
You cannot specify a column width on data type text.
Madhivanan
Failing to plan is Planning to fail
Post #710978
solutionsdxb
solutionsdxb
Posted Wednesday, May 06, 2009 6:34 AM
Forum Newbie
Group: General Forum Members
Last Login: Sunday, January 10, 2010 12:19 AM
Points: 8,
Visits: 46
nvarchar(max)
solved my purpose , thanks a lot !
Post #710998
Grant Fritchey
Grant Fritchey
Posted Wednesday, May 06, 2009 7:11 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 3:51 AM
Points: 13,372,
Visits: 25,154
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
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #711034
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.