select distinct source_type, alias, alias_desc, id, '' contractName, '' assignedContractNbr, 0 contractId, 0 requestId from qmd_aliasesRaw where source_type like '%EDI%' select r.requestId, c.assignedContractNbr, c.contractName, c.contractId from tbl_TPM_Requests r with (nolock) inner join tbl_TPM_Contracts c with (nolock) on c.ownerId = r.ownerId and c.ownerType = r.ownerType and c.contractId = r.contractId where c.ownerId = and c.ownerType = and c.assignedContractNbr = and r.chainSequence = 1 select * from qmd_aliases where requestId > 0 select * from qmd_aliases where requestId = 0

select distinct c.partnerId, c.partnerType, pod.contractNbr, pod.contractDescription, 0 as requestId, '' alias, '' alias_desc, '' source_type from tbl_TPM_ProofOfDelivery pod with (nolock) inner join tbl_TPM_ClaimContracts cc with (nolock) on cc.ownerId = pod.ownerId and cc.ownerType = pod.ownerType and cc.contractNbr = pod.contractNbr and cc.claimId = pod.claimId inner join tbl_TPM_Claims c with (nolock) on c.ownerId = cc.ownerId and c.ownerType = cc.ownerType and c.claimId = cc.claimId where cc.ownerId = and cc.ownerType = and cc.claimId = and nullif( cc.requestId, 0 ) is null and c.edi = 'Y' and c.ediReady = 'Y' select * from qmd_resolvedAliases where alias = and alias_desc =
#contractNbr# #contractDescription# Found #qmd_lookup.recordCount#
select * from qmd_resolvedAliases where alias =
#contractNbr# Found #qmd_lookup.recordCount#
select * from qmd_resolvedAliases where alias like
#contractNbr#% Found #qmd_lookup.recordCount#
select * from qmd_aliases where alias =
#contractNbr# Found #qmd_lookup.recordCount# Unresolved
select * from qmd_aliases where alias like
#contractNbr#% Found #qmd_lookup.recordCount# Unresolved
select * from tbl_TPM_ContractReferences where ownerId = and ownerType = and contractRef = and partnerId = and partnerType =

New Reference

insert into tbl_TPM_ContractReferences ( ownerId, ownerType, partnerId, partnerType, requestId, contractRef, confirmed, confirmDate, confirmUserId, createDate, createUserId ) values ( , , , , , , 'Y', , 0, , 0 )

Bad Reference

update tbl_TPM_ContractReferences set confirmed = 'Y', confirmDate = , confirmUserId = 0, requestId = where ownerId = and ownerType = and contractRef = and partnerId = and partnerType = and requestId = select cc.claimId, cc.contractNbr from tbl_TPM_ClaimContracts cc inner join tbl_TPM_Claims c on c.claimId = cc.claimId and c.ownerId = cc.ownerId and c.ownerType = cc.ownerType where c.ownerId = and c.ownerType = and c.partnerId = and c.partnerType = and cc.contractNbr = and cc.requestId =

#qmd_claimContracts.recordCount# are mapped wrong

update tbl_TPM_ClaimContracts set requestId = null where ownerId = and ownerType = and claimId = and contractNbr =

Confirmed Reference

update tbl_TPM_ContractReferences set confirmed = 'Y', confirmDate = , confirmUserId = 0 where ownerId = and ownerType = and contractRef = and partnerId = and partnerType = and requestId =
select cc.claimId, cc.contractNbr from tbl_TPM_ClaimContracts cc inner join tbl_TPM_Claims c on c.claimId = cc.claimId and c.ownerId = cc.ownerId and c.ownerType = cc.ownerType where c.edi = 'Y' and c.ediReady = 'Y' and c.ownerId = and c.ownerType = and c.partnerId = and c.partnerType = and cc.contractNbr = and cc.claimId =

Claims not updated