6

We are getting below error msg in the pop-up windows, when trying to view the generated XML in SSMS - Sql Server.

SSMS XML -  Error Msg.

Microsoft SQL Server Management Studio

Unable to show XML. The following error happened: Unexpected end of file while parsing Name has occurred. Line 1, position 2097154.

jarlh
  • 42,561
  • 8
  • 45
  • 63
RP-
  • 61
  • 1
  • 4
  • 3
    Have you tried doing what it has suggested? Also, Line 1 position **2097154**?? Does your first line of XML *really* have over 2 million characters? – Thom A Jul 05 '18 at 08:07
  • Do you have an enclosing tag at the end of the file? Is it well formatted? – cdrrr Jul 05 '18 at 08:11
  • The data is not that long. In fact, if the record set is low ( like 20 ), there is no issue. – RP- Jul 05 '18 at 08:17
  • If there was "no issue" you wouldn't be getting the error you're getting. – Thom A Jul 05 '18 at 08:18
  • Can you view the contents by other methods? Perhaps [SqlCmd](https://learn.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-2017) or [Results to Text](https://www.mssqltips.com/sqlservertip/2346/different-options-for-query-results-in-sql-server-management-studio/)? – David Rushton Jul 05 '18 at 08:30
  • @Larnu A 2MB XML file is nothing special, and having everything on the same line is nothing special, either (it actually saves some space). – Tomalak Jul 05 '18 at 09:16
  • @RP- If you open the file in Internet Explorer, what happens? – Tomalak Jul 05 '18 at 09:18
  • @Tomalak you realise it isn't a file, right? It's a column, in SQL Server, of the data type `xml`. The OP won't be able to "open the file" in Internet Explorer; it's noy a file. – Thom A Jul 05 '18 at 09:20
  • No, I didn't realize. Where does it say that? I read "generated XML", that could be anything. – Tomalak Jul 05 '18 at 09:26

1 Answers1

2

You will not be able to fix this beyond what SSMS can support when it comes to viewing the XML data in SSMS. I would suggest any of the following resolutions:

  • Change the parameters of what is pushing that XML data into your server so that the overall size can be limited. For example, if this XML data contains all values for a data point for the past year, perhaps break it up into quarters instead and push them separately into the server.
  • Export the data instead of trying to view it in SSMS.
Ryan Harris
  • 329
  • 2
  • 9