Why XML Output is Truncated

Why XML Output is Truncated

am 30.07.2007 16:51:41 von Mo hariri

Hi,
I am trying to generate an XML output form the database. I am
executing

select * from Request_vw for xml auto

The output data is being truncated. is there a limit on the output
result of an XML query?

Thanks

Re: Why XML Output is Truncated

am 30.07.2007 22:17:39 von Hugo Kornelis

On Mon, 30 Jul 2007 07:51:41 -0700, Mo wrote:

>Hi,
>I am trying to generate an XML output form the database. I am
>executing
>
>select * from Request_vw for xml auto
>
>The output data is being truncated. is there a limit on the output
>result of an XML query?
>
>Thanks

Hi Mo,

In SQL Server Management Studio: Tools / Options / Query Results / SQL
Server / Results to Text / Maximum number of characters displayed in
each column

In Query Analyzer: Tools / Options / Results / Maximum characters per
column

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

Re: Why XML Output is Truncated

am 31.07.2007 03:37:42 von Mo hariri

Thank you for the great pointer. Here is the problem. I am calling a
function to retrieve the data in XML format. The problem is that it
returns only nvarchar(8000) which is smaller than what I need. I think
that is why the returning data is being truncated. my function is as
follows. Any ideas on how to return larger XML string is greatly
appreciated.


CREATE FUNCTION GetXMLRequests()
RETURNS nvarchar(max)
AS
BEGIN
-- Declare the return variable here
RETURN (select * from Request_vw for xml auto)

END
GO

Re: Why XML Output is Truncated

am 01.08.2007 21:13:58 von Hugo Kornelis

On Mon, 30 Jul 2007 18:37:42 -0700, Mo wrote:

>Thank you for the great pointer. Here is the problem. I am calling a
>function to retrieve the data in XML format. The problem is that it
>returns only nvarchar(8000) which is smaller than what I need. I think
>that is why the returning data is being truncated. my function is as
>follows. Any ideas on how to return larger XML string is greatly
>appreciated.
>
>
>CREATE FUNCTION GetXMLRequests()
>RETURNS nvarchar(max)
>AS
>BEGIN
> -- Declare the return variable here
> RETURN (select * from Request_vw for xml auto)
>
>END
>GO

Hi Mo,

Any reason why you want to return nvarchar(max) rather than use the
dedicated xml datatype?

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis