Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Insert with OPENXML Statement Generates Duplicate Key Error


View products that this article applies to.

This article was previously published under Q295054
BUG #: 236302 (SHILOH_BUGS)

↑ Back to the top


Symptoms

An attempt to use an OPENXML statement after an XML document has been mapped in memory and presented to the SQL Server server may return an error if following conditions are true:
  • An edge table or meta properties is used.
  • You are inserting data into a table with a unique key or primary key constraint.
The error that is returned resembles the following:
<?MSSQLError HResult="0x80040e2f" Source="Microsoft OLE DB Provider for SQL Server" Description="The statement has been terminated."?>
<?MSSQLError HResult="0x80040e2f" Source="Microsoft OLE DB Provider for SQL Server" Description="Violation of PRIMARY KEY constraint ''.
Cannot insert duplicate key in object ''."?>

↑ Back to the top


Cause

OPENXML returns a duplicate record set.

↑ Back to the top


Resolution

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

↑ Back to the top


Workaround

Install Microsoft Data Access Componenets (MDAC) version 2.6 SP1 or later.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 1.

↑ Back to the top


Keywords: KB295054, kbsqlserv2000sp1fix, kbfix, kbbug, kbqfe, kbhotfixserver

↑ Back to the top

Article Info
Article ID : 295054
Revision : 6
Created on : 9/26/2005
Published on : 9/26/2005
Exists online : False
Views : 301