web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AX creates columns with differing collation in SQL Database

(1) ShareShare
ReportReport
Posted on by

Hi there,

as I read the Dynamics 2012 System Requirements Whitepaper, SQL-Server collation Latin1_General_CI_AS should be fine for a German System. Unfortunately, there seem to be columns, where AX uses SQL_Latin1_General_CP1_CI_AS regardless of the Server collation and this leeds to error messages when trying to join tables.

Gino Deschênes basically had the same question some time ago here.

Can anyone confirm this as "normal" behaviour requiring some workaround or is there some other recommendation we might have missed?

*This post is locked for comments

I have the same question (0)
  • Vilmos Kintera Profile Picture
    46,149 on at

    Hi

    I can confirm that our Ax 2012 R1 production SQL database has the same layout as yours including the discordant collations, however everything is working fine.

    Can you please explain the situation and maybe give an example, where you would get error messages if you construct SQL Queries / Statements inside AX and get errors for the joins?

    You could construct direct SQL statements, or Views with computed columns in AX and force using a specific collation, so a join would not be broken in T-SQL using the COLLATE DATABASE_DEFAULT keyword after the column. Here is the documentation: msdn.microsoft.com/.../ms184391.aspx

  • Community Member Profile Picture
    on at

    Hi and thanx so far!

    The following select returns a SQL error along the lines of "collation conflict":

       SysEDTMigrationTable table;

       SysModelElement sme;

       select table

           join sme

               where   sme.Name == table.Name;

  • Vilmos Kintera Profile Picture
    46,149 on at

    Yes I can confirm the error exists. Also I wrote some code to see if it works as a Direct SQL statement from AX, that you need to run in a class, and that fails as well. The same executed as a T-SQL in SSMS works fine, so it is quite intriguing.

    server static void run()
    {
        SysEDTMigrationTable            edtMigrationTable;
        SysModelElement                 sysModelElement;
    
        SqlStatementExecutePermission   sqlStatementExecutePermission;
        Connection                      connection;
        str                             statement;
        Statement                       sqlStatement;
        ResultSet                       retResultSet;
    
        // Error if DB collation is not SQL_Latin1_General_CP1_CI_AS
        select
            generateonly
            firstOnly Name from edtMigrationTable
            join sysModelElement
            where  sysModelElement.Name         == edtMigrationTable.Name
                && sysModelElement.ElementType  == UtilElementType::Table;
    
        statement = edtMigrationTable.getSQLStatement();
        statement = strReplace(statement, '=T1.NAME', '=T1.NAME COLLATE DATABASE_DEFAULT');
        //info(statement);
        
        connection      = new Connection();
        sqlStatementExecutePermission = new SqlStatementExecutePermission(statement);
        sqlStatementExecutePermission.assert();
        sqlStatement    = connection.createStatement();
        retResultSet    = sqlStatement.executeQuery(statement);
    
        if (retResultSet)
        {
            while (retResultSet.next())
            {
                info(retResultSet.getString(1));
            }
        }
    
        sqlStatement.close();
        CodeAccessPermission::revertAssert();
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans