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?
*This post is locked for comments
Never Mind,
I found out why the ClearCompany script would fail... :-)
I ran the whole script in debug mode in SSMS and when it failed it was because it was trying to delete entries from a table called 'syDeployedReports_bak', which of course wasn't part of the exclusion in the script itself, thus it would be considered as a regular user table to check for CompanyID..
So the script actually works, just be careful there is no copy or backup table of the syDeployedReports object !
PS: I actually improved the script itself, as the syDeployedReports table would be left with orphaned entries from the process after the clean-up. I added the following statement right after the 1st line with the declare statement to start loopin the GPsystem table.
DELETE FROM dynamics..syDeployedReports WHERE CompanyID NOT IN (SELECT INTERID FROM DYNAMICS..SY01500)
I'm actually stumped, because the latest script version I have that is supposed to work for all GP versions from G10 to 2016 already includes a section of the code to ignore the 'syDeployedReports' table, but it doesn't seem to work
declare companyID_Cleanup1 CURSOR for
select ''delete '' + rtrim(o.name) + '' where companyID not in (0,-32767)
and companyID not in (select CMPANYID from SY01500)''
from sysobjects o join syscolumns c on o.id = c.id and o.type = ''U''
where c.name = ''companyID'' and o.name <> ''SY01500'' and o.name <> ''syDeployedReports''
order by o.name
open companyID_Cleanup1
fetch next from companyID_Cleanup1 into @statement
while (@@fetch_status <> -1) begin
exec (@statement)
fetch next from companyID_Cleanup1 into @statement
end
close companyID_Cleanup1
deallocate companyID_Cleanup1
declare companyID_Cleanup2 CURSOR for
select ''delete '' + rtrim(o.name) + '' where companyID <> ''''' + rtrim(@GPSystem) + '''''
and companyID <>'''''''' and companyID not in (select INTERID from SY01500)''
from sysobjects o join syscolumns c on o.id = c.id and o.type = ''U''
where c.name = ''companyID'' and o.name <> ''SY01500'' and o.name = ''syDeployedReports''
order by o.name
open companyID_Cleanup2
fetch next from companyID_Cleanup2 into @statement
while (@@fetch_status <> -1) begin
exec (@statement)
fetch next from companyID_Cleanup2 into @statement
end
close companyID_Cleanup2
deallocate companyID_Cleanup2
I know this is old stuff, but it comes back on a recurrent basis and bites us everytime we try to run the ClearCompany script to clean-up old references, but then if fails invariably on the convert issue when Excel or SSRS reports are deployed within GP.
Will anyone ever fix this script to get this sorted out? since it's a known issue and we know that the culprit lies in the syDeployedReports table, why don't simply fix it ?
Every once in a while when you stumble across this bug, you don't remember the exact cause and have to start searching the internet about a solution, whereas this could be a pretty simple thing to be fixed I guess..
Thanks for your insights.
PS: modify the ClearCompany script to take into account that particular table, or fix the deployement of reports process and replace the value from "CompanyID" by the true ID or change the name of the column to match the "INTERID" name of the SY01500 table.
Thank you very much! I will do that!
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
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!
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,
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.
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.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156