NopCommerce Upgrade Error

Published:
The aim of this article is to help you solve the error "Cannot insert the value NULL into column 'ShortDescription', table 'albert_store.dbo.Nop_Product'; column does not allow nulls. UPDATE fails." problem and allow you to continue updating your NopCommerce version.

Warning: I do NOT advise using these instructions on a live application, but instead recommend you create a development environment first and deploy the new upgraded version of NopCommerce there.

It is important before proceeding to backup all your data, making a copy of your running DB before you execute the described operation. Backup can be performed either from your hosting control panel or from the admin menu of NopCommerce.


Problem.

During the upgrade of your NopCommerce version, may happen that the installation fails and it shows up the following error message:

An error occured: Cannot insert the value NULL into column 'ShortDescription', table 'albert_store.dbo.Nop_Product'; column does not allow nulls. UPDATE fails.
The statement has been terminated. Running scripts from file: C:\inetpub\wwwroot\nopCommerce_1.60\NopCommerceStore\install\Scripts\1.60\nopCommerce_upgrade.sql

Please note that the path included (C:\inetpub\wwwroot\nopCommerce_1.70_Source\NopCommerceStore\install\Scripts\1.60) may vary. In general the path (relative to the application) should be something like:
YOUR STORE \ install \ Scripts \ VERSION \ nopCommerce_upgrade.sql

Open in new window



Solution.

The described procedure is valid (and tested) on upgrades from version 1.4 and above (1.5 - 1.6 - 1.7 - 1.8).

In this case, it is possible that the upgrade fails because in the Nop_Product table there are some rows with NULL value for the field "ShortDescription". The error comes up because the upgrade script alters the field ShortDescription and reapplies the NOT NULL constraint, which causes records having NULL to fail this new constraint.

To sort out this issue, run the following SQL query to see if any records have a NULL value in their ShortDescription field:
SELECT COUNT(*)
                      FROM Nop_Product
                      WHERE (ShortDescription IS NULL)
                      

Open in new window


If the executed query shows that you have records that are NULL, run the following query to fix the problem:
UPDATE Nop_Product
                      SET ShortDescription = ''
                      WHERE (ShortDescription IS NULL)
                      

Open in new window


This will give a value for the field and you should be able to proceed with planned upgrade.
0
4,197 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.