Upgrades Questions on upgrading to version 7.x.
Version 7.x > Upgrades > 6.0 to 7.0 SQL Script errors View modes: 
User avatar
Member
Member
mr_phil - 2/15/2013 5:43:08 AM
   
6.0 to 7.0 SQL Script errors
I have just run the upgrade executable on our v6.0.45 (SP1)‎ web project and received the following SQL errors. Any ideas?

ALTER VIEW [View_CMS_Tree_Joined] AS 
SELECT CASE WHEN (DocumentIsArchived IS NULL OR DocumentIsArchived = 0) AND ((DocumentCheckedOutVersionHistoryID IS NULL AND DocumentPublishedVersionHistoryID IS NULL) OR (DocumentCheckedOutVersionHistoryID IS NOT NULL AND DocumentPublishedVersionHistoryID IS NOT NULL)) AND (DocumentPublishFrom IS NULL OR (DocumentPublishFrom IS NOT NULL AND DocumentPublishFrom <= getdate())) AND (DocumentPublishTo IS NULL OR (DocumentPublishTo IS NOT NULL AND DocumentPublishTo >= getdate())) THEN 1 ELSE 0 END AS Published, V.*, SKU.[SKUID], SKU.[SKUNumber], SKU.[SKUName], SKU.[SKUDescription], SKU.[SKUPrice], SKU.[SKUEnabled], SKU.[SKUDepartmentID], SKU.[SKUManufacturerID], SKU.[SKUInternalStatusID], SKU.[SKUPublicStatusID], SKU.[SKUSupplierID], SKU.[SKUAvailableInDays], SKU.[SKUGUID], SKU.[SKUImagePath], SKU.[SKUWeight], SKU.[SKUWidth], SKU.[SKUDepth], SKU.[SKUHeight], SKU.[SKUAvailableItems], SKU.[SKUSellOnlyAvailable], SKU.[SKUCustomData], SKU.[SKUOptionCategoryID], SKU.[SKUOrder], SKU.[SKULastModified], SKU.[SKUCreated], SKU.[SKUSiteID], SKU.[SKUPrivateDonation], SKU.[SKUNeedsShipping], SKU.[SKUMaxDownloads], SKU.[SKUValidUntil], SKU.[SKUProductType], SKU.[SKUMaxItemsInOrder], SKU.[SKUMaxPrice], SKU.[SKUValidity], SKU.[SKUValidFor], SKU.[SKUMinPrice], SKU.[SKUMembershipGUID], SKU.[SKUConversionName], SKU.[SKUConversionValue], SKU.[SKUBundleInventoryType], SKU.[SKUMinItemsInOrder], SKU.[SKURetailPrice], SKU.[SKUParentSKUID], SKU.[SKUAllowAllVariants], SKU.[SKUInheritsTaxClasses], SKU.[SKUInheritsDiscounts], SKU.[SKUTrackInventory], SKU.[SKUShortDescription], SKU.[SKUEproductFilesCount], SKU.[SKUBundleItemsCount], SKU.[SKUInStoreFrom], SKU.[SKUReorderAt], U.FullName AS NodeOwnerFullName, U.UserName AS NodeOwnerUserName, U.Email AS NodeOwnerEmail
FROM View_CMS_Tree_Joined_Regular V WITH (NOEXPAND) LEFT OUTER JOIN dbo.View_COM_SKU AS SKU ON V.NodeSKUID = SKU.SKUID LEFT OUTER JOIN dbo.CMS_User U ON V.NodeOwner = U.UserID
UNION ALL
SELECT CASE WHEN (DocumentIsArchived IS NULL OR DocumentIsArchived = 0) AND ((DocumentCheckedOutVersionHistoryID IS NULL AND DocumentPublishedVersionHistoryID IS NULL) OR (DocumentCheckedOutVersionHistoryID IS NOT NULL AND DocumentPublishedVersionHistoryID IS NOT NULL)) AND (DocumentPublishFrom IS NULL OR (DocumentPublishFrom IS NOT NULL AND DocumentPublishFrom <= getdate())) AND (DocumentPublishTo IS NULL OR (DocumentPublishTo IS NOT NULL AND DocumentPublishTo >= getdate())) THEN 1 ELSE 0 END AS Published, V.*, SKU.[SKUID], SKU.[SKUNumber], SKU.[SKUName], SKU.[SKUDescription], SKU.[SKUPrice], SKU.[SKUEnabled], SKU.[SKUDepartmentID], SKU.[SKUManufacturerID], SKU.[SKUInternalStatusID], SKU.[SKUPublicStatusID], SKU.[SKUSupplierID], SKU.[SKUAvailableInDays], SKU.[SKUGUID], SKU.[SKUImagePath], SKU.[SKUWeight], SKU.[SKUWidth], SKU.[SKUDepth], SKU.[SKUHeight], SKU.[SKUAvailableItems], SKU.[SKUSellOnlyAvailable], SKU.[SKUCustomData], SKU.[SKUOptionCategoryID], SKU.[SKUOrder], SKU.[SKULastModified], SKU.[SKUCreated], SKU.[SKUSiteID], SKU.[SKUPrivateDonation], SKU.[SKUNeedsShipping], SKU.[SKUMaxDownloads], SKU.[SKUValidUntil], SKU.[SKUProductType], SKU.[SKUMaxItemsInOrder], SKU.[SKUMaxPrice], SKU.[SKUValidity], SKU.[SKUValidFor], SKU.[SKUMinPrice], SKU.[SKUMembershipGUID], SKU.[SKUConversionName], SKU.[SKUConversionValue], SKU.[SKUBundleInventoryType], SKU.[SKUMinItemsInOrder], SKU.[SKURetailPrice], SKU.[SKUParentSKUID], SKU.[SKUAllowAllVariants], SKU.[SKUInheritsTaxClasses], SKU.[SKUInheritsDiscounts], SKU.[SKUTrackInventory], SKU.[SKUShortDescription], SKU.[SKUEproductFilesCount], SKU.[SKUBundleItemsCount], SKU.[SKUInStoreFrom], SKU.[SKUReorderAt], U.FullName AS NodeOwnerFullName, U.UserName AS NodeOwnerUserName, U.Email AS NodeOwnerEmail
FROM View_CMS_Tree_Joined_Linked V WITH (NOEXPAND) LEFT OUTER JOIN dbo.View_COM_SKU AS SKU ON V.NodeSKUID = SKU.SKUID LEFT OUTER JOIN dbo.CMS_User U ON V.NodeOwner = U.UserID

Failed to run SQLscript: Hint 'noexpand' on object 'View_CMS_Tree_Joined_Regular' is invalid.

CREATE NONCLUSTERED INDEX [IX_View_CMS_Tree_Joined_Regular_ClassName_NodeSiteID_DocumentForeignKeyValue_DocumentCulture]
ON [View_CMS_Tree_Joined_Regular] ([ClassName], [NodeSiteID], [DocumentForeignKeyValue], [DocumentCulture])
ON [PRIMARY]

Failed to run SQLscript: Cannot create index on view 'View_CMS_Tree_Joined_Regular'. It does not have a unique clustered index.

CREATE UNIQUE CLUSTERED INDEX [IX_View_CMS_Tree_Joined_Regular_NodeSiteID_DocumentCulture_NodeID]
ON [View_CMS_Tree_Joined_Regular] ([NodeSiteID], [DocumentCulture], [NodeID])
ON [PRIMARY]

Failed to run SQLscript: CREATE INDEX failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

CREATE NONCLUSTERED INDEX [IX_View_CMS_Tree_Joined_Linked_ClassName_NodeSiteID_DocumentForeignKeyValue_DocumentCulture]
ON [View_CMS_Tree_Joined_Linked] ([ClassName], [NodeSiteID], [DocumentForeignKeyValue], [DocumentCulture])
ON [PRIMARY]

Failed to run SQLscript: Cannot create index on view 'View_CMS_Tree_Joined_Linked'. It does not have a unique clustered index.

CREATE UNIQUE CLUSTERED INDEX [IX_View_CMS_Tree_Joined_Linked_NodeSiteID_DocumentCulture_NodeID]
ON [View_CMS_Tree_Joined_Linked] ([NodeSiteID], [DocumentCulture], [NodeID])
ON [PRIMARY]

Failed to run SQLscript: CREATE INDEX failed because the following SET options have incorrect settings: 'ARITHABORT'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 2/16/2013 9:01:42 AM
   
RE:6.0 to 7.0 SQL Script errors
Hello,

Could you please confirm that your site was offline during the upgrade?

It seems to be caused by some inconsistence in DB - it seems there are duplicate records in some tables even if it shouldn't be there. Could you please restore original DB backup and then perform upgrade of DB again?

Could you please also make sure, that the user which you are using in the connection string/connection to the database, has the correct schema and user assigned to it as highlighted in the attached screenshot?

Some views also need to be refreshed (View_CMS_Tree_Joined_Linked, View_CMS_Tree_Joined_Regular). You should be able to open the view in design mode and just hit save to refresh the definition.

About the Arithaborat function... one of our customers have experienced a similar issue and here is the solution:
"I have done some checking and ARITHABORT seems to be some SQL function. It seems that although my SQL server is 2008 R2 , the database compatibility level is still set to 80 (SQL 2000) for this DB. Changing it to level 90 has removed the error."

Best regards,
Martin Danko

User avatar
Member
Member
mr_phil - 2/18/2013 8:13:20 AM
   
RE:6.0 to 7.0 SQL Script errors
Thanks, the issue was the database compatibility level. I changed this and the second attempt worked flawlessly.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 2/19/2013 3:28:24 AM
   
RE:6.0 to 7.0 SQL Script errors
Hi,

Thanks for letting me know. I'm very glad to hear that!

Best regards,
Martin Danko