Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 788397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:21:27+00:00 2026-05-14T21:21:27+00:00

In this live SQL Server 2008 (build 10.0.1600) database, there’s an Events table, which

  • 0

In this live SQL Server 2008 (build 10.0.1600) database, there’s an Events table, which contains a text column named Details. (Yes, I realize this should actually be a varchar(MAX) column, but whoever set this database up did not do it that way.)

This column contains very large logs of exceptions and associated JSON data that I’m trying to access through SQL Server Management Studio, but whenever I copy the results from the grid to a text editor, it truncates it at 43679 characters.

I’ve read on various locations on the Internet that you can set your Maximum Characters Retrieved for XML Data in Tools > Options > Query Results > SQL Server > Results To Grid to Unlimited, and then perform a query such as this:

select Convert(xml, Details) from Events
where EventID = 13920

(Note that the data is column is not XML at all. CONVERTing the column to XML is merely a workaround I found from Googling that someone else has used to get around the limit SSMS has from retrieving data from a text or varchar(MAX) column.)

However, after setting the option above, running the query, and clicking on the link in the result, I still get the following error:

Unable to show XML. The following error happened:
Unexpected end of file has occurred. Line 5, position 220160.

One solution is to increase the number of characters retrieved from the server for XML data. To change this setting, on the Tools menu, click Options.

So, any idea on how to access this data? Would converting the column to varchar(MAX) fix my woes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:21:28+00:00Added an answer on May 14, 2026 at 9:21 pm

    SSMS only allows unlimited data for XML data. This is not the default and needs to be set in the options.

    enter image description here

    One trick which might work in quite limited circumstances is simply naming the column in a special manner as below so it gets treated as XML data.

    DECLARE @S varchar(max) = 'A'
    
    SET @S =  REPLICATE(@S,100000) + 'B' 
    
    SELECT @S as [XML_F52E2B61-18A1-11d1-B105-00805F49916B]
    

    In SSMS (at least versions 2012 to current of 18.3) this displays the results as below

    enter image description here

    Clicking on it opens the full results in the XML viewer. Scrolling to the right shows the last character of B is preserved,

    However this does have some significant problems. Adding extra columns to the query breaks the effect and extra rows all become concatenated with the first one. Finally if the string contains characters such as < opening the XML viewer fails with a parsing error.

    A more robust way of doing this that avoids issues of SQL Server converting < to &lt; etc or failing due to these characters is below (credit Adam Machanic here).

    DECLARE @S varchar(max)
    
    SELECT @S = ''
    
    SELECT @S = @S + '
    ' + OBJECT_DEFINITION(OBJECT_ID) FROM SYS.PROCEDURES
    
    SELECT @S AS [processing-instruction(x)] FOR XML PATH('')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a database that would eventually live on a shared SQL Server 2008
I have this requirement to migrate a live SQL server 2008 to MySQL server
I am working on a project which uses a relational database (SQL Server 2008).
I am deploying an ASP.NET application and SQL Server (2008) database on a live
I have table a and table b . (SQL Server 2008) Both tables have
I'm using MS SQL Server 2008R2, but I believe this is database agnostic. I'm
We have an application which stores its data in SQL Server. Each table has
I have a SQL Server 2008 Database running on Express. I want to copy
I've got a database (SQL Server) and a live website accessing that database through
I am releasing a database build to SQL Server 2000 via a batch file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.