select r.assignedContractNbr, r.assignedContractNbr blacksmithPromotionNbr, r.ownerId, r.ownerType, r.requestId, r.comments, c.partnerId, c.partnerType, c.contractName, r.startDate, r.endDate, 0 chainSequence, 0 lastApprovedChainSequence, c.contractId from tbl_TPM_Requests r inner join tbl_TPM_Contracts c on c.ownerId = r.ownerId and c.ownerType = r.ownerType and c.contractId = r.contractId where r.ownerId = 1 and r.ownerType ='MFR' and r.comments like 'Blacksmith Promotion: %' and r.status = 'APPROVED' and r.comments like '%' + r.assignedContractNbr + '[_]%' order by blacksmithPromotionNbr, endDate update tbl_TPM_Requests set sourceRequestId = , chainSequence = where ownerId = and ownerType = and requestId = and contractId = update tbl_TPM_Requests set sourceRequestId = null where ownerId = and ownerType = and sourceRequestId = update tbl_TPM_Contracts set lastApprovedChainSequence = where ownerId = and ownerType = and contractId =