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 :
Supply chain | Supply Chain Management, Commerce
Unanswered

Migrating Orphan Tables to D365 F&SCM AOT — Sync Failures & Data Restoration Issue

(3) ShareShare
ReportReport
Posted on by

Hi all, 

 

We are migrating legacy tables that exist in AXDB but were never created through the AOT. We created AOT definitions for these tables and triggered sync — but sync kept failing because the table already existed in SQL.

 

Temporary Solution

We renamed the legacy table so D365 could create it fresh:
 sql
EXEC sp_rename 'SFD10001', 'SFD10001_OLD'
  Sync then successfully created a clean D365-managed SFD10001.
 

The New Problem — Data Restoration

  When we tried restoring data from the old table back into the new one:
 sql
INSERT INTO SFD10001 (...) SELECT (...) FROM SFD10001_OLD
 

It failed because the old table had nullable values in several columns, but D365 creates all columns as NOT NULL — even when Mandatory = No is set in AOT. D365 does not support nullable columns at all; instead it substitutes default values (0, '', 1900-01-01) for empty fields.

 

So any NULL values in the old table have no direct equivalent in the new D365-managed table.

 

Has anyone dealt with this data restoration challenge? How did you handle NULL values when migrating legacy data into AOT-managed tables?

I have the same question (0)
  • CU01071803-1 Profile Picture
    on at

    Yes. This is expected behavior in Dynamics 365 F&SCM. AOT-managed tables do not support SQL NULL values. Regardless of whether Mandatory is set to Yes or No, the physical SQL columns are created as NOT NULL. The Mandatory property is enforced by the application, not by allowing SQL NULLs. 

    Your options are:

    Transform the data during migration by replacing NULL values with appropriate defaults using ISNULL() or COALESCE(). For example, map NULL strings to '', integers to 0, dates to the appropriate default (or another business-appropriate value), and enums to a valid enum value.

    Review each nullable column individually to determine whether a default value preserves the intended business meaning. A blanket replacement isn't always appropriate.

    If the distinction between NULL and a default value is business-critical, you'll need to redesign the table (for example, add a flag indicating whether a value was originally unknown), since D365 F&SCM cannot persist SQL NULLs in AOT-managed tables.

     

    This data transformation step is a normal part of migrating legacy SQL tables into AOT-managed tables. There is no supported way to make AOT-generated columns nullable in the database.

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 > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 178 Super User 2026 Season 1

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 83 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 77

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans