Select the product you need help with
FIX: Error message in SQL Server 2008 when you run an INSERT SELECT statement on a table: "Violation of PRIMARY KEY constraint '<PrimaryKey>'. Cannot insert duplicate key in object '<TableName>'"Article ID: 970507 - View products that this article applies to. Microsoft distributes Microsoft SQL Server 2008 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. On This PageSYMPTOMSConsider the following scenario:
Msg 2627, Level 14, State 1 Violation of PRIMARY KEY constraint 'PrimaryKey'. Cannot insert duplicate key in object 'TableName'. If you examine the execution plan, you find that the JOIN operator and the Eager Spool operator run in parallel. This Eager Spool operator is under the JOIN operator. Additionally, the table that receives the data in the statement is the inner table of the join. Note This issue also occurs when you run the UPDATE SELECT statement or the DELETE SELECT statement. CAUSEThis issue occurs because of a bug in the spool for the Eager Spool operator where the spool generates more rows than expected. This behavior causes a duplicate key issue. RESOLUTIONCumulative update informationThe fix for this issue was first released in Cumulative Update 3 for SQL Server 2008 Service Pack 1. For more information about this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:971491 Note 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 fix release. Microsoft recommends 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:
(http://support.microsoft.com/kb/971491/LN/
)
Cumulative update package 3 for SQL Server 2008 Service Pack 1970365
Microsoft SQL Server 2008 hotfixes are created for specific SQL Server service packs. You must apply a SQL Server 2008 Service Pack 1 hotfix to an installation of SQL Server 2008 Service Pack 1. By default, any hotfix that is provided in a SQL Server service pack is included in the next SQL Server service pack.
(http://support.microsoft.com/kb/970365/LN/
)
The SQL Server 2008 builds that were released after SQL Server 2008 Service Pack 1 was released
Hotfix informationA supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next SQL Server 2008 service pack that contains this hotfix.To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site: http://support.microsoft.com/contactus/?ws=support Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
(http://support.microsoft.com/contactus/?ws=support)
PrerequisitesTo apply this hotfix, you must have a computer that is running SQL Server 2008 Service Pack 1 (SP1).Restart informationYou do not have to restart the computer after you apply this hotfix.Registry informationYou do not have to change the registry.Hotfix file informationThis hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel. For all supported x86-based versions of SQL Server 2008 Database EngineCollapse this table
For all supported x86-based versions of SQL Server 2008 Analysis ServicesCollapse this table
For all supported x64-based versions of SQL Server 2008 Database EngineCollapse this table
For all supported x64-based versions of SQL Server 2008 Analysis ServicesCollapse this table
For all supported Itanium-based versions of SQL Server 2008 Database EngineCollapse this table
For all supported Itanium-based versions of SQL Server 2008 Analysis ServicesCollapse this table
WORKAROUNDTo work around this issue, set the MAXDOP query hint or the MAXDOP option to 1 at the statement or the server level. Note The server level MAXDOP option affects the performance of all the queries that run on the server. STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. REFERENCESFor more information about the Incremental Servicing Model for SQL Server, click the following article number to view the article in the Microsoft Knowledge Base:
935897
(http://support.microsoft.com/kb/935897/
)
An Incremental Servicing Model is available from the SQL Server team to deliver hotfixes for reported problems
For more information about the naming schema for SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base: 822499
(http://support.microsoft.com/kb/822499/
)
New naming schema for Microsoft SQL Server software update packagesFor more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base: 824684
(http://support.microsoft.com/kb/824684/
)
Description of the standard terminology that is used to describe Microsoft software updatesProperties | Article Translations |


Back to the top








