stackoverflowuser
stackoverflowuser

Reputation: 22380

XML input getting truncated

I have an xml doc (size: 3.59 mb) with 3765815 total characters in it. My sql server 2008 database table has a column with xml data type. When I try to insert this xml into the column it seems to truncate it.

I thought xml data type can handle 2GB of data. Is this a correct understanding or am i missing something?

Thanks

Here is the query i am using

declare printxml nvarchar(max) 

select printxml=cast(inputxml as varchar(max))
from TableA
where SomeKey='<some key>'

print printxml

Upvotes: 1

Views: 941

Answers (1)

Jon Seigel
Jon Seigel

Reputation: 12401

Select the data directly instead of printing it to the messages window:

SELECT
    inputxml
    FROM TableA
    WHERE SomeKey = '<somekey>'

The caveat is that you have to set up Management Studio to be able to return all the data to the window. You do that using the following option (the default setting is 2MB):

Upvotes: 4

Related Questions