AL icon indicating copy to clipboard operation
AL copied to clipboard

[Bug]: Cloud Migration fails on BC 29 On-Premises with SqlErrorNumber=50018 due to obsolete '%$ext' table schema check

Open HaiNT89 opened this issue 1 month ago • 3 comments

Describe the issue

When running Cloud Migration from Business Central 29 On-Premises (29.0.54011.55407 / 29.0.54011.56136) to Business Central Online v29 (29.0.54011.56136), the replication / data transfer task fails with SqlErrorNumber=50018: DB schema of Business Central on-premises does not correspond to its version: 29.

By inspecting the SQL Server plan cache (sys.dm_exec_query_stats / sys.dm_exec_sql_text) on the On-Premises SQL Server, we identified that the Azure Data Factory (ADF) pre-check script executes the following validation before copying tables:

-- Check that the source BC version corresponds to its schema
DECLARE @BaseExtensionExists int = 0
IF EXISTS (SELECT TOP 1 * FROM sys.tables WHERE [name] LIKE '%$437dbf0e-84ff-417a-965d-ed2bb9650972' OR [name] LIKE '%$63ca2fa4-4f03-4f2b-a480-172fef340d3f')
    SET @BaseExtensionExists = 1
 
SET @FailureMessage = CONCAT('DB schema of Business Central on-premises does not correspond to its version: ', @OnPremMajor, '.')
IF @BaseExtensionExists = 0 -- DBs with versions higher than 14 are expected to contain base or system extension tables
    THROW 50018, @FailureMessage, 1
 
IF @OnPremMajor >= 23 AND NOT EXISTS (SELECT TOP 1 * FROM sys.tables WHERE [name] LIKE '%$ext') -- DBs with versions 23 and higher are expected to contain compound table extension tables
    THROW 50018, @FailureMessage, 1

Root Cause: Starting in Business Central 29 (2026 Release Wave 2), table extension fields are merged directly into the base table in SQL Server instead of creating separate $ext (compound table extension) tables. Consequently, a BC 29 On-Premises database does not contain any tables matching LIKE '%$ext', causing the condition IF @OnPremMajor >= 23 AND NOT EXISTS (SELECT TOP 1 * FROM sys.tables WHERE [name] LIKE '%$ext') to always throw error 50018.

Expected behavior

The Cloud Migration pre-check script in the Azure Data Factory pipeline should account for the new BC 29 single-table data model (where $ext tables are no longer generated) and allow replication to proceed without throwing SqlErrorNumber=50018.

Specifically, the check for LIKE '%$ext' tables should be restricted to versions 23 through 28 (IF @OnPremMajor BETWEEN 23 AND 28) or removed for @OnPremMajor >= 29.

Steps to reproduce

  1. Prepare a Business Central 29.0 On-Premises database (29.0.54011.55407 / 29.0.54011.56136) with SQL Change Tracking enabled (Retention >= 3 days) and SQL Compatibility Level >= 130.
  2. In a Business Central 29.0 Online environment (29.0.54011.56136), open the Cloud Migration Setup Wizard (Page 4000) and connect to the On-Premises SQL database via Microsoft Integration Runtime.
  3. Complete the setup wizard and trigger the replication / migration (Run Migration Now).
  4. Observe the failure in TransferTask (ExecuteQueryAsyncTask) with SqlErrorNumber=50018: DB schema of Business Central on-premises does not correspond to its version: 29.

Additional context

  • BC Online Base Application Version: 29.0.54011.56136
  • Intelligent Cloud Base Version: 29.0.54011.55407
  • ADF Pipeline Region: msasia<redacted>_BC_Preparation

Error Stack Trace:

TraceComponentId: TransferTask
TraceMessageId: TransferRunFailed
FunctionName: Execute
eventId: TransferRunFailed
message: Copy failed with error: 'Type=System.Data.SqlClient.SqlException,Message=DB schema of Business Central on-premises does not correspond to its version: 29.,Source=.Net SqlClient Data Provider,SqlErrorNumber=50018,Class=16,ErrorCode=-2146232060,State=1'

I will provide a fix for a bug

  • [ ] I will provide a fix for a bug

HaiNT89 avatar Oct 19 '26 06:10 HaiNT89

Thank you for the bug report, we have implemented a fix which will roll out soon.

jehelles avatar Oct 20 '26 10:10 jehelles

When will this fix be ready - i've just spent the last 3 hours tracking this down

davecintron avatar Oct 27 '26 22:10 davecintron

I created an empty table in SQL named Test$ext and the Cloud Migration passed the version check. I tried to create this through an AL extension but the table name turned out as Text$ext[GUID}. Evidently the $ext string must be at the end of the table name. We will see how Cloud Migration proceeds.

davecintron avatar Oct 30 '26 22:10 davecintron