FIX: Error message when you export a virtual catalog in Commerce Server 2007: "Line 0: Violation of PRIMARY KEY constraint 'PK__#Relationships____<string>'. Cannot insert duplicate key in object 'dbo.#Relationships'"

Article translations Article translations
Article ID: 973970
Expand all | Collapse all

On This Page

SYMPTOMS

When you export a virtual catalog in Microsoft Commerce Server 2007, the catalog is not exported successfully. Additionally, events that resemble the following are logged in the Application log:

Event 1

Event Type: Error
Event Source: Commerce Server Business UI
Event Category: None
Event ID: 100
Description: Microsoft.CommerceServer.Catalog.CatalogException: Line 0: Violation of PRIMARY KEY constraint 'PK__#Relationships____<string>'. Cannot insert duplicate key in object 'dbo.#Relationships'. The statement has been terminated.

Event 2

Event Type: Error
Event Source: Commerce Server Web Services
Event Category: None
Event ID: 1
Description: An exception occurred in the 'ExportCatalog' Web service. Exception details follow: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK__#Relationships____<string>'. Cannot insert duplicate key in object 'dbo.#Relationships'. The statement has been terminated.
This problem usually occurs in one of the following scenarios.
  1. In a virtual catalog, you add relationships from two categories to one other category.
  2. You have a virtual catalog that includes a base catalog. In the virtual catalog, you add a relationship from one category to another category. Additionally, you add a relationship from the first category to a product of the base catalog.
Specifically, this problem may occur in the following two scenarios:

Scenario 1

  1. You create a virtual catalog that is called Virtual_Catalog.
  2. In Virtual_Catalog, you create three categories: VC1, VC2 and VC3.
  3. You add a relationship from VC2 to VC1.
  4. You add a relationship from VC3 to VC1.
  5. You try to export the virtual catalog.

Scenario 2

  1. You create a virtual catalog that is called Virtual_Catalog.
  2. You include a base catalog that is called Base_Catalog in Virtual_Catalog.
  3. In Virtual_Catalog, you create two categories: VC1 and VC2.
  4. You add a relationship from VC1 to VC2.
  5. You add a relationship from VC1 to a product that belongs to Base_Catalog.
  6. You try to export the virtual catalog.

CAUSE

This problem occurs because of an error in the stored procedure that builds relationships for a category or for a product.

RESOLUTION

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, 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.

Prerequisites

You must have Commerce Server 2007 Service Pack 2 installed to apply this hotfix.

Restart requirement

You do not have to restart the computer after you apply this hotfix. However, you must restart Internet Information Services (IIS) and the Commerce Server Catalog Import Host COM+ application after you apply this hotfix. To restart IIS, at a command prompt, type the following command, and then press ENTER:
IISRESET /RESTART
Note This option stops and then restarts all IIS services that are running.

Hotfix replacement information

This hotfix does not replace any other hotfixes.

File information

The English version of this fix has the file attributes (or later versions) 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.

Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Catalogcreate.sqlNot applicable1,151,00421-Jul-200913:17Not applicable

Installation instructions

After you extract the hotfix package, you obtain the following files:
  • CommerceServer2007SP2-KB973970-ENU.exe
  • Ctlg_ExportRelationships.sql
  • Hotfix.txt
Install the CommerceServer2007SP2-KB973970-ENU.exe file to update the Catalogcreate.sql file. This makes sure that virtual catalogs can be exported successfully for new catalog databases.

Additionally, run the Ctlg_ExportRelationships.sql file against the existing catalog databases to update the problematic stored procedure for existing catalog databases. You must restart IIS by running the following command for the update to take effect:
IISRESET /RESTART

STATUS

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

MORE INFORMATION

For more information about how to create category and product relationships, visit the following Microsoft Web site:
http://msdn.microsoft.com/en-us/library/ms943034.aspx
For more information about how to manage virtual catalogs, visit the following Microsoft Web site:
http://msdn.microsoft.com/en-us/library/ms915778.aspx

Properties

Article ID: 973970 - Last Review: October 7, 2011 - Revision: 2.0
Keywords: 
kbexpertiseadvanced kbsurveynew kbqfe KB973970

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com