select ownerId, ownerType, proofOfDeliveryId, flagComment, flagLinkId, flagLinkType, '' newFlagComment from tbl_TPM_ProofOfDelivery where flagged = 'Y' and flagComment like 'Excluded Operator%' and flagComment like '%,' + flagLinkType + ',' + convert( varchar, flagLinkId ) and flagLinkType = 'TPM' select opr.companyName from tbl_OPR_ClientOperators opr with (nolock) inner join tbL_TPM_Contracts ct with (nolock) on ct.ownerId = opr.ownerId and ct.ownerType = opr.fsltablecode and ct.partnerId = opr.operatorId and ct.partnerType = 'OPR' inner join tbl_TPM_Requests r with (nolock) on r.ownerId = ct.ownerId and r.ownerType = ct.ownerType and r.contractId = ct.contractId where r.ownerId = and r.ownerType = and r.requestId =
#ownerType##ownerId# #htmleditformat( flagComment )# #htmleditformat( _newFlagComment )#
update tbl_TPM_ProofOfDelivery set flagComment = where ownerId = and ownerType = and proofOfDeliveryId = and flagComment = Updated #_updated#