Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

SQL get larege xml data from database field

I have xml value in a field in a database.  I want to look at "all" the data.  I want to copy it and past it in NotePad++.  When I write a select statement and copy what is in the field it is truncating the data.  

How do you write a select so I can get everything in that field?
SOLUTION
Avatar of grendel777
grendel777
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CipherIS

ASKER

Seems to still be truncating the results.
Are you sending the query results to Text or Grid?
Can you also check the length of the field?
SELECT LEN(XMLField)
FROM YourTableName
WHERE <YourCriteria>

Open in new window

I tried the Len on my select statement on the XML field but received the below error.

Msg 8116, Level 16, State 1, Line 5
Argument data type text is invalid for argument 1 of len function.
You'll need to cast it to a string type in order to get the length (see my previous post):
CAST(XMLField AS VARCHAR(MAX))

Open in new window

Oh, is a Text field. Then follow Grendel's suggestion to convert it to VARCHAR(MAX).
I used the below code and it still seems to be cutting it off.

CAST(XMLField AS VARCHAR(MAX))

Open in new window