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

Announcements

News and Announcements icon
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
    Microsoft Employee 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,423 Super User 2026 Season 1 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,344 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,742 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,231

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans