Mahmoud has updated his attachment report for GP 2018.
Dynamics GP 2018 – Attachment Report – All Attachments ( Updated SQL Script )
Reporting & BISQL & DataDevelopment & IntegrationGP 2018
Archived post from 2017. Dynamics GP and the links it points to have changed since; check current documentation before relying on version-specific steps.