Change Rate Calculation Method To Divide

Microsoft Dynamics GPThis is a script I hope not to need in future, but as I have had to write it, I figured I might as well post it.

When creating an exchange rate table in Multicurrency Exchange Rate Table Setup (Administration » Setup » System » Exchange Table)several fields need to be defined. One of them is the Rate Calculation Method which is set to either Divide or Multiply.

This field can be changed until there are rates entered. The reason this script was created was for a client who create several currencies, entered quite a few rates and then realised that the flag for Rate Calculation Method was set to Multiply instead of Divide.

The choices were either to delete all rates or to change the data behind the scenes; the script took five minutes to write and test, whereas doing the update manually would have taken near an hour.

So script it was. Before I ran the update, I double checked to make sure there were no transactions and also that there was a good backup of the system database.

UPDATE
	MC40300
SET
	RTCLCMTD = 1
WHERE
	EXGTBLID IN ('USD','EURO')
GO

The yellow highlighted section is the list of currencies to update.

This script should NOT be run when transactions for the currency being updated have been entered.