The given value of type String from the data source cannot be converted to type nvarchar of the specified target column.

Today I experienced this problem while importing models from the build machine into one of the developer machines:

The given value of type String from the data source cannot be converted to type nvarchar of the specified target column.

A quick search on the internet took me to this blog post that explains the importance of initializing / updating your model store after installing CU’s. To initialize/update your model store you simply have to run the AxUtil with the schema command. (Alternative for powershell is Initialize-AXModelStore)

For a full list of AXUtil and PowerShell commands, please refer to MSDN.

Dynamics 2012 R2 In-place Upgrade : Configuration Issues

Today I was performing an in-place upgrade to R2 and that was an adventure on it’s own 🙂
First let’s start of by saying that the in-place upgrade documentation on MSDN was really helpful and well written!

But anyway, I wanted to tell you about two specific issues that I’ve encountered :

  • Database and AOS on different machines
  • AOS and locating the Model Store

Database and AOS on different machines

When I ran the installer to configure the existing database, the new R2 models from Microsoft were installed in the Model Store database, but the ‘old’ models were not copied from the other database to the new model store. The white paper mentions possible trouble, but I just performed the data upgrade on a single machine and that was that.

AOS and locating the Model Store

The other issue was a bit more interesting. When the data upgrade was done, I restore the database over the existing one on the target environment. But when I started the AOS server, I received a huge amount of DB sync issues. At first I was surprised since I am used to restoring databases and connecting the AOS to them. Once done, you should have the same situation but here it was not the case.

Further investigation pointed out that the installer forgot some things when upgrading the AOS. Namely, updating the existing configuration of the AOS. Since R2, there are two new parameters in the configuration files : ModelDBServer and ModelDatabase. But they have been left blank.

dbserver,Text,MYSQL
database,Text,AX60_XXXX
ModelDBServer,Text,
ModelDatabase,Text,

So at this point,  the AOS starts and since the isntaller did not remove the old models from the data database, it is still a valid model store and Ax starts!
Filling in these values with the correct model store database solved the issue.

PS: The same is happening for the Max Buffer Size parameter (Left at 24kb and R2 need 40kb)