Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML Output is Truncated in SQL

Tags:

I need to return my result set in XML and this works fine, but if the number of records are increased, my xml output is truncated here is my query

select t.id,t.name,t.address from test FOR XML AUTO, ROOT('Response'), ELEMENTS 

However I have set some option to increase the output result set like..

Tools --> Options --> Query Results --> SQL Server --> Results to Text --> Maximum               number of characters displayed in each column Tools --> Options --> Results --> Maximum characters per column 

but still I am unable to get my desired result.

please suggest my solution

EDIT: However when I click on the XML, it open in another query window and all xml shown here, but it not return all xml instead of truncated xml.

Thanks....

like image 630
Muhammad Akhtar Avatar asked Apr 30 '10 06:04

Muhammad Akhtar


People also ask

Can we use XML in SQL?

Support for XML is integrated into all the components in SQL Server in the following ways: The xml data type. XML values can be stored natively in an xml data type column that can be typed according to a collection of XML schemas, or left untyped. You can index the XML column.


1 Answers

Try the following:

Declare @xmldata xml set @xmldata = (select ... From test for xml...) select @xmldata as returnXml 
like image 70
user3791994 Avatar answered Sep 27 '22 17:09

user3791994