Microsoft KB Archive/919641

= Error message when you try to upgrade Microsoft Dynamics CRM by using the upgrade wizard: &quot;The foreign key constraints in the Microsoft CRM database are not consistent&quot; =

Article ID: 919641

Article Last Modified on 1/4/2008

-

APPLIES TO


 * Microsoft Dynamics CRM 4.0
 * Microsoft Dynamics CRM 3.0

-



SYMPTOMS
When you try to upgrade Microsoft CRM 1.2 to Microsoft Dynamics CRM 3.0 by using the upgrade wizard, you receive the following error message in the Upgrade Diagnostic Wizard window:

The foreign key constraints in the Microsoft CRM database are not consistent with Microsoft CRM 1.2 foreign key constraints.

When you try to upgrade Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0 by using the upgrade wizard, you receive the following error message in the Upgrade Diagnostic Wizard window:

The foreign key constraints in the Microsoft CRM database are not consistent with Microsoft CRM 3.0 foreign key constraints.

Additionally, you see one or more of the following details if you view the installation log file. You see the following details if you deleted a foreign key:

09:41:33| Error| remark: deleted foreign key

09:41:33| Error| tablename: quotebase

09:41:33| Error| columnname: accountid

09:41:33| Error| referencedtablename: accountbase

09:41:33| Error| referencedcolumnname: accountid

09:41:33| Error| foreignkeyname: account_quotes

You see the following details if you added a constraint:

10:35:45|Warning| remark: added unique constraint on column

10:35:45|Warning| tablename:

10:35:45|Warning| columnname:

The  placeholder is a placeholder for the actual table name. The  placeholder is a placeholder for the actual column name.

Notes  The default location of the installation log file is the following location in which the  placeholder represents the actual drive of the system:



 The  placeholder is a placeholder for the table name. The  placeholder is a placeholder for the actual column name.



Upgrade Microsoft CRM 1.2 to Microsoft Dynamics CRM 3.0
This problem occurs because the foreign keys and the references to the foreign keys are missing from the Microsoft CRM 1.2 tables. Or, this problem occurs because constraints were manually added to the Microsoft CRM 1.2 tables.

Upgrade Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0
This problem occurs because the foreign keys and the references to the foreign keys are missing from the Microsoft Dynamics CRM 3.0 tables. Or, this problem occurs because constraints were manually added to the Microsoft Dynamics CRM 3.0 tables.



Resolution 1: The foreign keys and the references to the foreign keys are missing
To resolve this problem, run the following script to add the foreign keys to the Microsoft Dynamics CRM tables.

Note Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs. Alter Table  placeholder represents the actual drive of the system:



For example, you view the following setup log:

09:41:33| Error| remark: deleted foreign key

09:41:33| Error| tablename: quotebase

09:41:33| Error| columnname: accountid

09:41:33| Error| referencedtablename: accountbase

09:41:33| Error| referencedcolumnname: accountid

09:41:33| Error| foreignkeyname: account_quotes

09:41:33| Error|

In this example, run the following script against the MSCRM database to add the foreign key to the quotebase table. alter table quotebase add constraint account_quotes foreign key (accountid) references accountbase (accountid)

Resolution 2: Constraints were manually added
To resolve this problem, delete the constraints that were manually added to the Microsoft Dynamics CRM tables. To do this, follow these steps:
 * 1) Start SQL Enterprise Manager.
 * 2) Expand Microsoft SQL Servers, expand SQL Server Group, expand the instance of SQL Server that contains the Microsoft Dynamics CRM databases, and then expand Databases.
 * 3) Expand the  _MSCRM database, and then click Table.
 * 4) In the list of tables on the right side of the window, right-click the table name that is mentioned in the log, and then click Design Table.
 * 5) Search the Column Name field for the column name that is mentioned in the log. Right-click the column name, and then click Check Constraints.
 * 6) Click Delete to delete the manually created constraint.

Keywords: kbmbscrm40 kbtshoot kbmbsupgrade kberrmsg kbmbsmigrate kbprb KB919641

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.