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 will update the description of G/L accounts by suffixing them with the description of the third segment.
/*
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).
*/
UPDATE
['Account Master']
SET
['Account Master'].ACTDESCR = LEFT(RTRIM(['Account Master'].ACTDESCR) + ' - ' + RTRIM(['Segment Description Master-Segment 3'].DSCRIPTN),50)
FROM
GL00100 AS ['Account Master'] --Breakdown Account Master (GL00100)
INNER JOIN
GL40200 AS ['Segment Description Master-Segment 3'] --Segment Description Master (GL40200)
ON
['Segment Description Master-Segment 3'].SGMTNUMB = 3
AND
['Segment Description Master-Segment 3'].SGMNTID = ['Account Master'].ACTNUMBR_3
AND
LEN(RTRIM(['Segment Description Master-Segment 3'].DSCRIPTN)) > 0
GO