select VI.VersionID, VN.ParentName, VN.FolderName,FF.FormatID, FF.Name, .dbo.ve_getshortPath(vi.ItemID) Location
from vefn_GetVersionFormatItems('') VI
Join Formats FF on FF.FormatID = VI.FormatID
Join vefn_GetVersionNames() VN ON VI.VersionID = VN.VersionID
Join Contents CC on VI.ContentID = Cc.ContentID
Where CC.Type < 20000 and FF.Name = 'GEN'
order by VersionID, Location