This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script checks the status of Analytical Accounting in all companies connected to the system database.
/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://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).
*/
SELECT
['Company Master'].CMPANYID AS CompanyID,
['Company Master'].INTERID AS SQLDatabase,
['Company Master'].CMPNYNAM AS CompanyName,
['Analytical Acctg. Company Setup'].aaCompanyStatus AS AAType,
CASE ['Analytical Acctg. Company Setup'].aaCompanyStatus
WHEN 4 THEN 'Activated'
WHEN 5 THEN 'Activation previously failed'
ELSE 'Not activated'
END AS AAStatus
FROM
DYNAMICS..AAG00104 AS ['Analytical Acctg. Company Setup']
JOIN
DYNAMICS..SY01500 AS ['Company Master']
ON
['Company Master'].CMPANYID = ['Analytical Acctg. Company Setup'].CMPANYID
ORDER BY
AAType DESC, CompanyID