SBX - Search With Button

SBX - Forum Post Title

Clear Company Script fails

Microsoft Dynamics GP Forum

Richard Wheeler asked a question on 26 May 2017 7:02 AM
My Badges

Question Status

Verified

I am running the latest version of the Clear Company scripts and I am getting this message on every company. 

"Conversion failed when converting the varchar value 'MyInterID' to data type int.

The other odd thing is I cannot add the TWO company. GP Utilities goes through all the motions but the record for TWO never gets added to the SY01500 table.

Has anyone ever experienced this? Any clues as to how to correct?

Reply
Tim Foster responded on 26 May 2017 7:49 AM
My Badges

I downloaded what I think is the current ClearCompanies and I don't see a reference to MyInterID.  It would help me if you posted what you're running.

Have you put a trigger on SY01500?

I would run a SQL TRACE to see the exact cause.  

Failure to add the TWO company is consistent with INSERT/UPDATE failure similar to your Clear company issue.

Tim

Reply
Richard Wheeler responded on 26 May 2017 8:33 AM
My Badges
Verified Answer

The problem was with this table -  DYNAMICS..syDeployedReports. I had to remove the SY01500.INTERID value for each company. Once I did that the ClearCompany script ran with no issues and the TWO company is now created. This is very odd and one night when I cannot sleep I will try to figure out what caused this.

Reply
Béat Bucher responded on 29 May 2017 11:57 AM
My Badges

Hi Richard,

The version I have for the ClearCompanyDB script is dated June 2014 & supposed to be compatible with GP 2013 and the SL Designer..

I woulnd't have suspected that the syDeployedReports could be causing issues here.. but nonetheless, ths is one of those tables you have to be very careful when creating a new TEST enviornment for a future upgrade.. read on here

As explained by Microsofot (Sarah Purdy) here (blogs.msdn.microsoft.com/.../microsoft-dynamics-gp-ssrs-reports-and-deployment), GP Utilities automatically re-deploys SSRS & Excel reports based on the content of this table, whith the adverse effect of scrapping your existing enviromnet if you don't change the values inside that table first.

Reply
Derek Albaugh responded on 5 Jun 2017 10:05 AM
My Badges

Hello Richard,

The main problem with the syDeployedReports table is that it has the 'CompanyID' column as a varchar data type, whereas, every other table that has a companyID or CMPANYID column, such as the SY01500 table (Company Master) that it references, is setup as a smallint data type.

The issue with the ClearCompanies script is that it attempts to compare the company ID values from other tables to the SY01500 and runs into an issue when it has a varchar value trying to compare it to a smallint value, thus the error message.

This is why the syDeployedReports table is probably 99% of the issues we see running the ClearCompanies script.

Thanks,

Reply
Danae Tillan responded on 16 Nov 2017 8:21 AM

Hello Derek, I am having the same issue when running the ClearCompanies script under my Test environment.  How can I solve this issue? I need to run this script because we deleted a company database in SQL Server Management Studio before it was deleted from Microsoft Dynamics GP.

Thank you!

Reply
Derek Albaugh responded on 16 Nov 2017 8:28 AM
My Badges

Hello Danae,

Normally when the ClearCompanies script fails, it'll throw an error message about what the varchar value is that it is trying to an integer value but cannot, similar to the error at the very beginning of this forum post.

What you'll need to do is run a script or something looking for that value in the tables of the DYNAMICS/system database, then when you find what table/columns this value is in, verify that it is a column setup as a varchar and not an integer.

As mentioned above, the most common table that causes this is the syDeployedReports table, you can try making a backup of that database, truncating this table, run the ClearCompanies script then if it is successful, put the data back into this table.

Thanks

Reply
Danae Tillan responded on 16 Nov 2017 10:22 AM

Thank you very much! I will do that!

Reply
Richard Wheeler responded on 26 May 2017 8:33 AM
My Badges
Verified Answer

The problem was with this table -  DYNAMICS..syDeployedReports. I had to remove the SY01500.INTERID value for each company. Once I did that the ClearCompany script ran with no issues and the TWO company is now created. This is very odd and one night when I cannot sleep I will try to figure out what caused this.

Reply

SBX - Two Col Forum

SBX - Migrated JS