Introduction:

Hey Buddies,…This is what happened…

Just a normal day of coding , I was restoring SQL backup from my Live database to my Test database in NAV. everything works cool.  Test database is restored.

Now I navigate to companies and try to rename the company to Test and bang….error!

error sql

The following SQL Server error was unexpected: Object ‘”dbo.”Liberty.Live$Production Forecast Entry”‘ cannot be renamed because object participates in enforced dependencies. Caution: changing any part of an object name cannot break scripts and stored procedure.

Pre-requisites:

  • Microsoft Dynamics NAV 2018
  • SQL Server Management Studio (SSMS)

Cause of this error:

MaintainSIFTIndex property

What is SIFT Index?

SumIndexFields are created in Microsoft Dynamics NAV to support FlowField calculations and other fast summing operations

MaintainSIFTIndex property  – Sets the value to determine whether SIFT structures should be created in SQL Server to support the corresponding SumIndexFields for the Microsoft Dynamics NAV key. The default value is set to yes.

Refer https://docs.microsoft.com/en-us/dynamics-nav/maintainsiftindex-property

NAV creates indexed views when value is Yes and save the table (and synchronize schema in newer versions)

So when you restore your database, the index views are also restored to the new database. Now when you rename a company in this database, conflict is created as index view still points to old database in my case Liberty Live database. hence the error!

Resolution to the error:

  • Launch SSMS, expand your test database and expand views

ssms2

  • In my scenario, Production Forecast Entry caused this error, so find the view casing the issue then delete them.
  • Rename the company.
  • After renaming successfully, Open Microsoft Dynamics NAV Development environment, Click on Tools > Sync, Schema for all tables > With Validations also Build server application objects and compile all objects.
  • You will notice the views which were deleted are recreated but with the new database name.

ssms3

 

Cheers!