// Selection of image data in the multimedia table
Select substring(SPATH from 6 for 200) Path , '/' || SUBSTRING(lower(sorgfilename) from 1 for 1) || '/' || SUBSTRING(lower(sorgfilename) from 2 for 1) || '/' || lower(sorgfilename) dest,sgroup FROM
MULTIMEDIA join stock on wrefid = wstockid where WREFID = <@WSTOCKID@> and STYPE = 'STOCK' and (SPATH like 'link:%'
 or SPATH like 'file:%') 
and (SGROUP = 'products_image')
