Disabled columns are sometimes included in SQL Queries created by the Dynamics AX Kernel

Over the last month we were facing a situation where the Dynamics AX 2009 Kernel was generating incorrect SQL Queries in a specific constellation:

    • You have one or more fields (columns) on a table that are based on an Extended Data Type (EDT)
    • This EDT has a Configuration Key assigned
  • This Configuraiton Key is turned off

So as a result the mentioned fields don’t exist in the SQL Server database.

Sometimes, especially then when the AOS was under a very heavy load, the Dynamics AX Kernel was generating SQL Queries that included the non-existing (disabled) fields (columns), of course resulting in a SQL Server error.

The AOS was logging the following error message to the event log:

Can not select a record in table TableName.
The SQL database has issued an error.
[Microsoft][SQL Native Client][SQL Server]Invalid column name ”ColumnName

As there was no consistent way to reproduce this random, sporadic issue, is was very hard to find the real root cause. Without going into further details the most important information is that the root cause of the issue was finally found.

The Dynamics AX 2009 SP1 Kernel Hotfix KB970335 is solving this issue.