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?
LVL 2
CipherISAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

grendel777Commented:
Try this:
SELECT CAST(XMLField AS VARCHAR(MAX))
FROM YourTable

Open in new window

Vitor MontalvãoMSSQL Senior EngineerCommented:
Check the options in your SSMS (Menu Tools/Options...). By default the results only presents 256 characters by column. You need to change it to a value that permits you to get all data.

SSMS-QueryLimit.PNG

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CipherISAuthor Commented:
Seems to still be truncating the results.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Vitor MontalvãoMSSQL Senior EngineerCommented:
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

CipherISAuthor Commented:
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.
grendel777Commented:
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

Vitor MontalvãoMSSQL Senior EngineerCommented:
Oh, is a Text field. Then follow Grendel's suggestion to convert it to VARCHAR(MAX).
CipherISAuthor Commented:
I used the below code and it still seems to be cutting it off.

CAST(XMLField AS VARCHAR(MAX))

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.