web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Constraints on table fields not being dropped before the field is dropped

(0) ShareShare
ReportReport
Posted on by 52

Recently our pipelines fail, because removed fields cannot be removed on SQL side.

This concerns our legacy product which is on BC18.16 OnPrem.

The field we are trying to remove looks like this in code:

field(904; "Print Loan detailed"; Boolean)
{
    Caption = 'Print Loan detailed';
}

The statement that gets run on sync (Mode ForceSync) is the following:

ALTER TABLE dbo."SKO_MV$Accounting Object$437dbf0e-84ff-417a-965d-ed2bb9650972" DROP COLUMN "Print Loan detailed"

And results in this error:

The object 'MDF_49CB3A659E879050D45A73CA5FF7670FF93B16D377C87234140C7B017BDD5D80' is dependent on column 'Print Loan detailed'.
ALTER TABLE DROP COLUMN Print Loan detailed failed because one or more objects access this column.

When I inspect the table in ssms I find the following constraint:

ALTER TABLE [dbo].[sko_mv$Accounting Object$437dbf0e-84ff-417a-965d-ed2bb9650972] ADD  CONSTRAINT [MDF_49CB3A659E879050D45A73CA5FF7670FF93B16D377C87234140C7B017BDD5D80]  DEFAULT ((0)) FOR [Print Loan detailed]

To me it seems like something is wrong with the metadata and the platform for some reaseon forgets to drop the contraint before dropping the field.

What I've tried so far: 

  1. Repair-NavApp and try again --> Didn't work; same error on sync
  2. Set an explicit InitValue of "true" --> sync --> remove field --> sync --> doesn't work
  3. Change the type to integer --> sync --> remove field --> sync --> WORKS!

At first we thought it might be an issue with this field only, which would have been OK. But now we start getting the same issue on multiple different fields.

We recently upgraded from 18.5 to 18.16, could this have something to do with it?

I tried a Cronus-Db (18.16) --> install our modified base app with the field included --> remove field --> sync --> works!

That's why I'm relatively sure that there is some broken metadata in the database we are using. But how can we fix this?

I have the same question (0)
  • Suggested answer
    Andy Sather Profile Picture
    on at

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    I will open this up to the community in case they have something to add.

  • DAnny3211 Profile Picture
    11,397 on at
  • Jakob Theiner Profile Picture
    52 on at

    Hi Andy! Thanks, I will try Yammer.

  • Jakob Theiner Profile Picture
    52 on at

    Hi Daniele,

    you're trying to answer my question with my question?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans