select 'OPR' domain, r.ownerId, r.ownerType, r.fileId, r.srcURL, c.fileName, c.subFolder, c.mainFolder, c.contentId
from tbl_OPR_Repository r
inner join tbl_FSC_Content c
on c.contentId = r.contentId
where r.ownerType = 'MFR'
and r.srcURL like '%agreementPDF.cfm?r=%'
union all
select 'CDR' domain, r.ownerId, r.ownerType, r.fileId, r.srcURL, c.fileName, c.subFolder, c.mainFolder, c.contentId
from tbl_CDR_Repository r
inner join tbl_FSC_Content c
on c.contentId = r.contentId
where r.ownerType = 'MFR'
and r.srcURL like '%agreementPDF.cfm?r=%'
order by ownerType, ownerId, domain
select requestId
from tbl_TPM_Requests
where ownerId =
and ownerType =
and requestId =
#ownerType#:#ownerId#:#domain#:#_requestId# : #htmleditformat( srcURL )# - #_fileName#
delete from tbl_FSC_Content
where contentId =
delete from tbl_#domain#_Repository
where fileId =
and ownerId =
and ownerType =