FIX: You receive error message 6603 or text data may be truncated when you select a text data type through the OPENXML provider in SQL Server 2000 (285006)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)
  • Microsoft XML 2.6
  • Microsoft Data Access Components 2.6

This article was previously published under Q285006
BUG #: 236142 (Shiloh_bug)

SYMPTOMS

When you select character data that is a Text data type through the OPENXML rowset provider, the text data may be truncated or you may receive the following error message:

Server: Msg 6603, Level 16, State 1
XML parsing error: System error: 265926.
If the text value tag in the XML code contains more than 3,956 characters but less than 7,907 characters, you receive the 6603 error message. If the value tag contains more than 7,907 characters, the text data is truncated silently.

RESOLUTION

SQL Server 2000

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to obtain the latest SQL Server 2000 service pack

MDAC

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to obtain the latest MDAC 2.6 service pack

Hotfix

Note The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 1.

The English version of this fix should have the following file attributes or later:
   Date        Version        Size    File name 
   ---------------------------------------------------
   01/23/2001  8.1.7123.0   688,912   Msxml2.dll	
   01/23/2001  8.1.7123.0    21,776   Msxml2a.dll	
   01/23/2001  8.1.7123.0    37,648   Msxml2r.dll
   01/23/2001  8.1.7123.0    26,384   Xmlinst.exe
				
If you are upgrading from the original released version of SQL Server 2000 to Microsoft SQL Server 2000 Service Pack 3 (SP3), this problem may occur. To resolve this problem, install the security update that is described in the following Microsoft Knowledge base article:

318202 MS02-008: XMLHTTP control in MSXML 2.6 can allow access to local files

The security update that is discussed in Microsoft Security Bulletin MS02-008 has the required files (version 8.2.8307.0).

STATUS

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

SQL Server 2000

This problem was first corrected in SQL Server 2000 Service Pack 1.

MDAC

This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.

MORE INFORMATION

Steps to reproduce the problem

  1. Create the stored procedure from the following script:
    /** Begin Script for reproducing the problem **/ 
    
    DROP PROCEDURE test_openxml
    GO
    CREATE PROCEDURE test_openxml
      @i_xml text
    AS
      begin
        declare @hr   integer
        declare @hdoc integer
    
        exec @hr = sp_xml_preparedocument @hdoc output,@i_xml
    
        if @hr = 0
        begin
           select datalength(value) 
              from openxml(@hdoc,'root/data',1) with(value text)
           exec sp_xml_removedocument @hdoc
        end
      end
    GO
    EXEC test_openxml '<?xml version="1.0" encoding="UTF-8"?>
    <root>
         <data value="<insert at least 4000 characters here>"/>
    </root>'
    GO
    
    /** End Script for reproducing the problem **/ 
    					
  2. Call this procedure and provide a valid XML string as parameter. The value of the data tag should contain at least 4,000 characters at the indicated location.
You either receive the 6603 error message or the OPENXML rowset provider truncates the text column after about 3,900 characters. The datalength function returns the actual length. The actual length is shorter than the string that is provided in the XML code.

Modification Type:MinorLast Reviewed:9/26/2005
Keywords:kbHotfixServer kbQFE kbbug kbfix kbMDAC260sp1Fix kbMSXMLnosweep kbQFE kbSQLServ2000sp1fix KB285006 kbAudDeveloper