Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
There's been partner blogs and forums about this particular error but we still see support cases on it, so we figured we would publish this blog and bring it to everyone's attention and have everything in the same place.
As the error message mentions, the ClearCompanies script throws this error message when it encounters a value in the CMPANYID, companyID, and related table columns/fields it is looking at, as those values should all be integer values, corresponding with the CMPANYID value in the SY01500/Company Master table, but from time to time, it encounters a varchar value, and thus throws this type of error as it is unable to compare an integer value with a varchar value.
Most common, we see this issue occur in the syDeployedReports table, as well as third-party or custom tables.
Luckily, we can use the following script to help identify which table/column combinations have the varchar value in it, causing the ClearCompanies script to fail, so we can resolve the issue.
The script I'm referring to is the 'Seach_All_Tables_For_A_Value.txt' attached to this blog.
Near the end of this script, there is the following lines:
/* Change the 'A100' to the value you are looking for on any tables...*/EXEC SearchAllTables 'A100'
What you'd need to do is change the 'A100' value in the EXEC SearchAllTables line, to the varchar value we're looking for. Using the title of this blog for example, we would use 'ABC', thus the line would look like this:
/* Change the 'A100' to the value you are looking for on any tables...*/EXEC SearchAllTables 'ABC'
When running this script, it will return the table/column name that has the value in it that we're searching for, along with the column value itself. Here is an example looking for the varchar value of 'OPEN':
Once we have this information, we can go through the results specifically looking for the CMPANYID, companyID, etc. columns that have the specified varchar value from the error message in it, then make changes accordingly whether it is to delete that record or modify the varchar value to an integer value.
After we do this, we should then be able to successfully run the ClearCompanies script against your Dynamics GP system database without further errors.
Hopefully this will save everyone some time if encountering this type of error message as well as a support case.
Business Applications communities