This script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posting the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.
This script was created to allow a client to quickly export the entire chart of accounts.
/*
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
['Account Index Master'].ACTNUMST AS 'Account'
,['Account Master'].ACTDESCR AS 'Account Description'
,['Account Category Master'].ACCATDSC AS 'Account Category'
,CASE ['Account Master'].PSTNGTYP
WHEN 0 THEN
'Balance Sheet'
ELSE
'Profit and Loss'
END AS 'Posting Type'
,CASE ['Account Master'].TPCLBLNC
WHEN 0 THEN
'Debit'
ELSE
'Credit'
END AS 'Typical Balance'
,USERDEF1 AS 'User-Defined 1'
,USERDEF2 AS 'User-Defined 1'
,USRDEFS1 AS 'User-Defined 1'
,USRDEFS2 AS 'User-Defined 4'
FROM
GL00100 AS ['Account Master'] --Breakdown Account Master (GL00100)
INNER JOIN
GL00105 AS ['Account Index Master'] --Account Index Master (GL00105)
ON
['Account Index Master'].ACTINDX = ['Account Master'].ACTINDX
INNER JOIN
GL00102 AS ['Account Category Master'] --Account Category Master (GL00102)
ON
['Account Category Master'].ACCATNUM = ['Account Master'].ACCATNUM