After Removing Fixed Asset Management Tables Add Entry To DB_Upgrade

Microsoft Dynamics GPIn the previous post, I posted a SQL script which can be used to delete all tables from a MIcrosoft Dynamics GP implementation for a specified product. That script will generate you the drop and delete commands required to remove a product, but may, for some products, still cause an error if you try to add the product again. I don’t have a screenshot of the error, but it is one where GP Utilities complains the module is too old to upgrade.

This is the case for Fixed Asset Management (FAM); I’ve also had the same problem when adding FAM for the first time. The below script can be used to add an entry to the DB_Upgrade table which will resolve the error.

The highlighted parameters, at the top of the script, will need to be defined; the versions should be the same as the products installed in Dynamics GP; I would avoid setting them to the same as the Dynamics GP product id as this is often different to the other features.

For fixed assets on Microsoft Dynamics GP 2016 R1, the major version and build number are set to 16 and 389 respectively.

If you have already tried to run GP Utilities, a row will have been inserted into DB_Upgrade table which will need to be upgraded.

But worry not, the script will update an existing row or insert a new one as appropriate.

Before running the script make sure that the update statement will not overwrite existing data with an invaoid value.

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://www.azurecurve.co.uk)
This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int).
*/
USE D16R1
GO

DECLARE @PRODID INT = 309
DECLARE @db_verMajor INT = 16
DECLARE @db_verBuild INT = 389

UPDATE DB_Upgrade SET db_verMajor = @db_verMajor, db_verBuild = @db_verBuild,db_verOldMajor = @db_verMajor, db_verOldBuild = @db_verBuild WHERE db_name = DB_NAME() AND PRODID = @PRODID

IF (SELECT COUNT(*) FROM DB_Upgrade WHERE db_name = DB_NAME() AND PRODID = @PRODID) = 0
	INSERT INTO DB_Upgrade (db_name,PRODID,db_verMajor,db_verMinor,db_verBuild,db_verOldMajor,db_verOldMinor,db_verOldBuild,db_status) VALUES (DB_NAME(),@PRODID,@db_verMajor,0,@db_verBuild,@db_verMajor,0,@db_verBuild,0)
GO

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.