Microsoft Knowledge Base Email Alertz

KBAlertz.com: (919641) - Describes a problem that occurs because the foreign keys and the references to the foreign keys are missing from the Microsoft CRM 1.2 tables. Provides a resolution.

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 919641 - Last Review: January 4, 2008 - Revision: 3.0

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

On This Page

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:<TableName>
10:35:45|Warning| columnname:<ColumnName>
The <TableName> placeholder is a placeholder for the actual table name. The <ColumnName> 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 System_drive placeholder represents the actual drive of the system:
    System_drive:\Documents and Settings\User\Application Data\Microsoft\MSCRM\Logs.
  • The TableName placeholder is a placeholder for the table name. The ColumnName placeholder is a placeholder for the actual column name.

CAUSE

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

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 <tablename> Add Constraint <foreignkeyname>
Foreign Key <referencedcolumnname> References <referencedtablename> <referencedcolumnname> 
Notes
  • The <tablename> placeholder represents the actual table name.
  • The <foreignkeyname> placeholder represents the foreign key name.
  • The <referencedcolumnname> placeholder represents the name of the column that is referenced.
  • The <referencedtablename> placeholder represents the name of the table that is referenced.
To determine which foreign key is missing, view the setup log file.

Note The default location of the setup log file is the following location in which the System_drive placeholder represents the actual drive of the system:
System_drive:\Documents and Settings\User\Application Data\Microsoft\MSCRM\Logs.
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 OrganizationName_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.

APPLIES TO
  • Microsoft Dynamics CRM 4.0
  • Microsoft Dynamics CRM 3.0
Keywords: 
kberrmsg kbtshoot kbprb kbmbsmigrate kbmbsupgrade kbmbscrm40 KB919641
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Anonymous User Report As Irrelevant  
Written: 9/12/2008 11:22 AM
It works for me to resolve 3 of the 7 '09:41:33| Error| remark: deleted foreign key ' errors

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please