[D365] DB Sync changed data type on field

When changing the data type of a table field (let's say from integer to string) in D365fO, the DB sync will work on the maschine of the developer that made the changes.
When this change is checked in and someone else is trying to synchronize his database with this change, he will habe a bad time and see an error message like this:

InvalidOperationException: Table ... : Converting Field '..' of Type '..' to '..' is not support. Please drop the original field, sync the table and add new field with same name if needed.

Error message DB synchronize changed type

In Dynamics AX 2012 it was as easy as dropping the table on the database and synchronizing it again.

With D365 for Operations, we now need to drop the table, delete all references from SQLDictionary of it, restart the iis service and then synchronize it again!
Here are the steps with a little SQL:

  • Drop the table and delete references from SQLDictionary:
DROP TABLE AXDB.dbo.NAMEOFTABLE

DELETE
FROM AXDB.dbo.SQLDICTIONARY
WHERE TABLEID IN (
	SELECT TABLEID
	FROM SQLDICTIONARY
	WHERE NAME = 'NAMEOFTABLE'
		AND FIELDID = 0
)
  • Restart IIS Service with iisreset
  • Run DB Synchronization again