2015 m. gegužės 14 d., ketvirtadienis

When Collation Takes Over

Hello AX World,

I once had a very interesting issue worth to share. I have recalled it recently when I wrote a SQL script.
This is specifically for databases with the collation Danish_Norwegian_CI_AS.
Consider these two statements:
The first is valid and the second is not. Why? Because AA and aA is treated differently in this collation.

I was running an upgrade (AX 2009 to AX 2012 CU7) and it failed on source environment, live preprocessing stage. It failed on the script:
ReleaseUpdateTransformDB50_SMA.smaAgreementLinePreUpgradeProcess

After spending some time and analyzing it turned out that the issues was due to the DB collation.

The upgrade framework have registered the script as "smAAgreementLinePreUpgradeProcess" but later it searched for "smaAgreementLinePreUpgradeProcess".
See the difference. AX is case insensitive! How could it happen?

As mentioned earlier, AA and aA is treated differently in in Danish_Norwegian_CI_AS collation. AA is converted to a Danish/Norwegian letteÅ and aA is remains aA, therefore the SQL statement could not find what it searched for.

The issues was resolved by making the registered value and search value equal. 

In particular, I had to change one line in method ReleaseUpdateTransformDB50_SMA.initTransformationJobs when it registered the script.

This a good example that a great developer have to consider much more than just it's code.

Be aware & take care! :)

Komentarų nėra:

Rašyti komentarą