Share via


Deprecated: X++ index hint clause

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

In Microsoft Dynamics AX 2009, the administrative tool named Microsoft Dynamics AX Server Configuration Utility offered an option that was labeled Allow INDEX hints on queries. Access to this configuration option is no longer available in the configuration utility for Microsoft Dynamics AX 2012, and the option is deprecated. In the system the option’s value is False by default.

Any legacy X++ select statements that include the index hint clause still run fine in Microsoft Dynamics AX 2012. But due to the default value of False, the index hint clause is now ignored, such as in the following code example:

    static void Main(Args _args)    // X++
    {
        CustTable custTableBuffer;
    
        custTableBuffer.disableCache(true);
    
        select
            generateOnly
            forceLiterals
                MainContactWorker
            from
                custTableBuffer
            INDEX HINT HcmWorkerIdx   //index hint is IGNORED in AX 2012.
            where
                custTableBuffer.MainContactWorker == 0
        ;
    
        Global::info(CustTableBuffer.getSQLStatement());
    }

    
    /*****
    The following is output pasted from the Infolog window, with
    whitespace added.
    Notice that this resultant SELECT statement, built by the AX AOS for
    Microsoft SQL Server, lacks an INDEX clause.
    That absence indicates that the AX X++ compiler ignored
    the 'index hint' clause.
    
    
    SELECT
        T1.MAINCONTACTWORKER, T1.RECID
      FROM
        CUSTTABLE T1
      WHERE
        ( ( (PARTITION=5637144576) AND
            (DATAAREAID=N'dat')
          ) AND
          (MAINCONTACTWORKER=0)
        )
    *****/

Overview

Item

Description

Reason for deprecation

This feature was rarely used. This feature began to create complications in the evolving development environment, so the feature was removed.

Replaced by another feature

No. There is no supported replacement for this feature.

Modules affected

This feature was not particular to any application module.

Changes to installation

This change does not affect application installation.

Changes to upgrade

Any legacy custom X++ code that uses the index hint clause still compiles and runs in Microsoft Dynamics AX 2012.