Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Clear Deleted Companies

Posted on by Microsoft Employee

Hello,

We are setting up a new test environment using GP 2010, Windows Server 2008 R2, and SQL 2012. 

There are 11 companies in the live system, but we are only moving 3 to the test.  I created the Dynamics database and 3 company databases in GP utitlities and then refreshed the data from backups of the live companies. The database compatibility levels have been changed to SQL 2012.

When I try to run the Clear Companies script to remove the databases from the Dynamics database that were not brought over to the test environment, I receive the following error:

"Msg 245, Level 16, State 1, Line1
Conversion failed when converting the varchar value 'HLAVA; to data type int."

Any ideas how to resolve?

*This post is locked for comments

  • Alan Cederquist Profile Picture
    Alan Cederquist 185 on at
    RE: Clear Deleted Companies

    I know this is an old post, but I ran into the same problem recently.  The root cause of my issue ended up being Greenshades Software.  They have several tables in the Dynamics database where they defined the companyid field as a character field and populated it with the interid not the numeric company id.  We excluded those tables and the clearcompanies script worked.  Then manually deleted records from those Greenshades tables.  I imagine other developers may have done something similar, so you might look at tables in the Dynamics database that have a companyid field that's not an integer type field.

  • Verified answer
    Re: Clear Deleted Companies

    Hello,

    I've seen this happen from time to time and manually run each part of the ClearCompanies script (from KB 869778), it'll actually go through, it's some time of syntax issue with the entire script running at one time, but we don't see this happen very often at all.

    I've also seen this occur running older versions of ClearCompanies script which aren't compatible with the version of SQL you're running it against. With SQL 2012, I tested the ClearCompanies script from KB 869778 and it went through successfully.

    Thanks,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: Clear Deleted Companies

    Hi,

    You could try manually creating a database in SQL with the same database name as one of the GP companies you are trying to delete. Then try the delete company through GP again?

    Ian.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans