MS Dynamics GP sql script to update the Direct Deposit master.

Employees may be inactive in the employee master table but show active records in the direct deposit tables. Use this script to identify employees that are inactive in the employee master table UPR00100, and that may have active direct deposit records in the direct deposit master DD00100 table, and the direct deposit account master DD00200 table.

SELECT dbo.DD00100.EMPLOYID, dbo.DD00100.INACTIVE, dbo.DD00200.EMPLOYID, dbo.DD00200.INACTIVE, dbo.UPR00100.EMPLOYID, dbo.UPR00100.INACTIVE FROM
dbo.DD00200 inner join dbo.UPR00100 on dbo.UPR00100.EMPLOYID = dbo.DD00200.EMPLOYID
inner join dbo.DD00100 on dbo.DD00100.EMPLOYID =
dbo.UPR00100.EMPLOYID

Script to set Inactive the records in the DD00100 and DD00200 that should be inactive.

update dbo.DD00100 set dbo.DD00100.INACTIVE = ’1′ where dbo.DD00100.EMPLOYID in (SELECT dbo.DD00100.EMPLOYID FROM dbo.DD00100 inner join dbo.UPR00100 on dbo.UPR00100.EMPLOYID = dbo.DD00100.EMPLOYID
where dbo.UPR00100.INACTIVE = ’1′)

update dbo.DD00200 set dbo.DD00200.INACTIVE = ’1′ where dbo.DD00200.EMPLOYID in (SELECT dbo.DD00200.EMPLOYID FROM dbo.DD00200 inner join dbo.UPR00100 on dbo.UPR00100.EMPLOYID = dbo.DD00200.EMPLOYID
where dbo.UPR00100.INACTIVE = ’1′)

In the Select subquery after the Update only one column reference is allowed.