Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Synchronize database creates incorrect SQL columns

Posted on by 291,219 Super User 2024 Season 2

Hi all,

We have a customer where a model was installed previously. Instead of updating the model, the old model was deleted and the new version installed. That caused some DB sync errors on creating indexes. This is happening on AX2012R2 with CU7 and various kernel builds, including the latest.

The error is:

Cannot execute a data definition language command on (). The SQL database has issued an error.
SQL error description: [Microsoft][SQL Server Native Client 10.0][SQL Server]Column name 'PARTITION#34' does not exist in the target table or view.
SQL statement: CREATE INDEX I_106718BATCHIDX ON "DBO".TABLENAME (PARTITION,RELATIONTYPE,PARTITION#34) WHERE INSTANCERELATIONTYPE IN ( 106718 )

Indeed the field Partition#34 was not defined. When looking at the table in the SQL database, it appears that almost all columns are wrongly define. They do have fields like Partition#34,Partition#35 and DataAreaID#21,DataAreaId#22. Also when we look at the table SQLDictionary, we see fields like Description created with SQL name Partition#34. 

The field types used for the table columns in SQL are also incorrect.

There are various environments where only one environment does have this issue. As there is some important data and also the latest developments in this environment, we cannot simply refresh it from the Production or another Test instance. 

Does anyone encounter this same issue before and found a solution to have the correct columns again in the SQL database and the SQLdictionary table?

*This post is locked for comments

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,219 Super User 2024 Season 2 on at
    RE: Synchronize database creates incorrect SQL columns

    Hi Sohaib,

    The query which fails is stated in the original post above. It is a model with an ISV solution which is installing fine in every other environment. Only one environment fails. Also if we create a new environment based on the database and modelstore where it goes wrong, it fails. So, I do think there is some reference in the database wrong.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Synchronize database creates incorrect SQL columns

    Hi André,

    Is it showing the failed query in Dynamics AX SQL synchronization log..?

    the fields like Partition#34,Partition#35 are created usually when multiple tables are joined in views. as the each table has these system fields so sql server combines these with a number.

    Secondly, is it a customized table or standard ax tables..?

    If you can email me the xpo for the table only i can try to import it into one or more environment, to see how it behaves in my VM on import and synch.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,219 Super User 2024 Season 2 on at
    RE: Synchronize database creates incorrect SQL columns

    I forgot to mention that this only happens for two tables which are part of table inheritance. Other tables are synchronized correctly.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,219 Super User 2024 Season 2 on at
    RE: Synchronize database creates incorrect SQL columns

    Hi Sohaib,

    Thanks for your input. The tables related to this model are empty, we cannot lose other data. We also dropped the tables and deleted related records from the SQLdictionary table. We also fully removed the model, restarted AOS and re-installed it multiple times. In your blog, you are also referring to the SQLSyncInfo table. This table is empty here.

    Unfortunately, your blog (however valuable) is not solving this problem.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Synchronize database creates incorrect SQL columns

    Hi André,

    I understand that saving data is important for you and this disallows you from dropping schema of the table.

    Have you had opportunity to follow something as this

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans