Symptoms

When you run a query that contains large object (LOB) data to load into a Transact-SQL variable in Microsoft SQL Server 2008, Microsoft SQL Server 2012 or Microsoft SQL Server 2008 R2, data corruption occurs. For example, you run the following query to copy XML data from a database column to an XML variable: Declare @OUTXML as XMLSELECT @OUTXML = DataXml FROM Table_1 WHERE id=1 In this situation, the SELECT statement runs when other threads try to update the same XML column. This behavior may cause data corruption. Additionally, you receive one of the following error messages when you perform any read and write operation on the corrupted XML column:

  • The XML data type is damaged.

  • Unexpected end of file has occurred.

Notes

  • The issue typically occurs during high concurrent load operations.

  • When you use a Log Reader agent to read the corrupted XML data from a table that is part of a publication article list for transactional replication, you receive the following error message:

    The XML data type is damaged. (Source: MSSQLServer, Error number: 6611)

Cause

This issue occurs because a lock on the LOB data column is released before the LOB data is copied from the database column to the LOB data type variable. Any concurrent query can update the same LOB data before the copy process is complete during the copy process. Therefore, data corruption occurs.

Resolution

Cumulative update information

Cumulative Update 7 for SQL Server 2012

The fix for this issue was first released in Cumulative Update 7. For more information about how to obtain this cumulative update package for SQL Server 2012, click the following article number to view the article in the Microsoft Knowledge Base:

2823247 Cumulative update package 7 for SQL Server 2012Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2012 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2692828 The SQL Server 2012 builds that were released after SQL Server 2012 was released

Cumulative Update 12 for SQL Server 2008 R2 Service Pack 1

The fix for this issue was first released in Cumulative Update 12. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:

2828727 Cumulative update package 12 for SQL Server 2008 R2 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 Service Pack 1 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 1 was released

Cumulative Update 10 for SQL Server 2008 Service Pack 3

The fix for this issue was first released in Cumulative Update 10. For more information about how to obtain this cumulative update package for SQL Server 2008 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:

2814783 Cumulative update package 10 for SQL Server 2008 Service Pack 3Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 Service Pack 3 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2629969 The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 3 was released

Cumulative Update 5 for SQL Server 2008 R2 Service Pack 2 (SP2)

The fix for this issue was first released in Cumulative Update 5. For more information about how to obtain this cumulative update package for SQL Server 2008 R2 S2008 R2 SP2, click the following article number to view the article in the Microsoft Knowledge Base:

2797460 Cumulative update package 5 for SQL Server 2008 R2 S2008 R2 SP2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 S2008 R2 SP2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2730301 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 2 was released

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.