Øyvind Hognestad
Nov 30, 2012
(3 votes)

An alter table database error can occur when upgrading from CMS6 to CMS7.

I recently tried to update a customers website from CMS6 R2 to CMS7 and got an error. The error is a database error and the reason is that my root page id <> 1. This customer had root id = 5.

This is the error message:

An unhandled error has occured:
The ALTER TABLE statement conflicted with the FOREIGN KEY SAME TABLE constraint
 "FK_tblContent_tblContent". The conflict occurred in database "dbForskningspar
kenUpgrade", table "dbo.tblContent", column 'pkID'.
When executing
At C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Upgrade\System Scripts\Upgrad
e Site Database (SqlServer).ps1:9 char:25
+       Execute-EPiSqlSvrScript <<<<  -EPiServerScript -ScriptPath $file 
-SqlServerName $dbConnection.DataSource -DatabaseName $dbConnection.InitialCatalog
-LoginName $dbConnection.UserID -LoginPassword $dbConnection.Password

A god thing, it’s easy to do a workaround:

* Open  this script :
"C:\Program Files\EPiServer\CMS\7.0.586.1Upgrade\Database\sql\ 0007_0000_0147_0000to0007_0000_0361_0000.sql".

* Find this insert:

INSERT INTO tblContent (fkContentTypeID,fkParentID,ArchiveContentGUID, CreatorName,
ExternalFolderID,fkMasterLanguageBranchID,ContentPath,ContentType) VALUES (

* Change the 1 to your root page id, in my case 5.

* Rerun the update from CMS6 to CMS7 in Deployment Center. Worked like a charm, except for the compilation error, but that’s another story.

Nov 30, 2012


Goran Solomonovic
Goran Solomonovic Feb 27, 2013 11:43 AM

Thanks! My root page id is not 1 either... :)

May 16, 2013 08:02 AM

And even more important, remember to set the value back to 1. If you forget, the next "normal" upgrade will fail..... (like it did today).

Please login to comment.
Latest blogs
Optimizely shortcuts in CMS 12 will get a trailing slash appended!

Not all URLs will work when the trailing slash is added, and that could cause problems. Hopefully it will be fixed soon.

Tomas Hensrud Gulla | Nov 26, 2022 | Syndicated blog

One week left of the beta certification period

Today it's one week until the last beta certification day. Do you exam no later than Wednesday the 30th.  Here are the reference and exam guides:...

Karen McDougall | Nov 23, 2022

Unbelievable FREE Heatmapping With Optimizely Web

Within this guide, you will learn how to integrate a free heat mapping tool to Optimizely Web so you can turbocharge your A/B testing capabilities....

Jon Jones | Nov 22, 2022 | Syndicated blog

Import Your Localized Resources in v7.5

Import functionality has been delayed for several versions of DbLocalizationProvider. However, with the help of community member - this feature has...

valdis | Nov 21, 2022 | Syndicated blog