XML size in a stored procedure

Posted on 2015-02-03
Last Modified: 2015-02-11
I have a stored procedure on SQL Server 2008 that returns an xml document.

It appears that the size of the xml is being truncated to 2Mb.

I have modified the max size of xml in Management Studio to unlimited but I still get the problem.

I wonder if there is some limitation on the size of the variable declared in the stored procedure, or the size of the result set?

Thanks for any advice.
Question by:soozh
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40586104
>It appears that the size of the xml is being truncated to 2Mb.
this is only the default output indeed.
if you check the len( youxml ), you will get the proper value, normally.

Author Comment

ID: 40586111
len(yourxml) does not work because it does not like xml data types.  Datalength does.

I have changed the outputr size to unlimited.

Somewhere i am being truncated to 2mb.

An should this SP be run by SQL Server Agent how do it set the size to unlimited there?
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40586129
>Datalength does.
yes, sorry. does it show the good size value?

>An should this SP be run by SQL Server Agent how do it set the size to unlimited there?
the question is what are you doing with the "output", in regards to sql server agent?
Veeam gives away 10 full conference passes

Veeam is a VMworld 2017 US & Europe Platinum Sponsor. Enter the raffle to get the full conference pass. Pass includes the admission to all general and breakout sessions, VMware Hands-On Labs, Solutions Exchange, exclusive giveaways and the great VMworld Customer Appreciation Part


Author Comment

ID: 40586171
With regards to the size issue when i run the sp in management studio:

The sp returns the xml, but when i click on it i get a message that its is malformed.  When i copy it and paste it into a file i get a file that is about (plus mins a few byte) 2mB

So i think that either the xml is truncated in the sp to 2Mb, or the transfer to Management Studio truncates the resulting xml to 2Mb.

I have changed the size to unlimited.

With regards to SQL Server Agent:

Just a question.  I have no intention of doing it but i was just wondering about other environments suchs an application.
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 500 total points
ID: 40586236
so, you confirm to have set in the Query Options, Grid, XML data to "unlimited" ?

Author Comment

ID: 40586379
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40588428
then I don't know how this could be "truncated" ... except maybe in the code

Author Comment

ID: 40602810
The problem seems to be solved when i rebooted everything.  The solution seems to be GRID XML data unlimited.


Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question