select interactionId, partnerId, partnerType, contactId, disposition, interactionPurposeId from tbl_CRM_Interactions with (nolock) where ownerId = and ownerType = and externalRef = and externalSource = select cdr_recordId from tbl_CDR_Distributors with (nolock) where ownerId = and fsl_tablecode = and cdr_dstCompanyType = 'B' and cdr_recordId = select interactionId, partnerId, partnerType, contactId, disposition, interactionPurposeId from tbl_CRM_interactions with (nolock) where ownerId = and ownerType = and partnerType = and partnerId = and dispositionUserId = and disposition = '?' order by interactionId desc select interactionPurposeId from tbl_CRM_interactions with (nolock) where ownerId = and ownerType = and interactionId = update tbl_CRM_interactions set externalRef = , externalSource = , interactionDate = , notes = , contactId = , dispositionDate = , disposition = 'X', cdrDistributorId = , recordSource = , sourceId = -1, sourceType = 'GEN' where ownerId = and ownerType = and interactionId = update tbl_CRM_interactions set updateDate = where ownerId = and ownerType = and interactionId = , 0 as updatedItem, 0 as newItem, saleSubjectType + cast( saleSubjectId as varchar ) as catalogKey from tbl_CRM_interactionSaleDetails with (nolock) where ownerId = and ownerType = and interactionId = ---> select *, itemType as saleSubjectType, skuId as saleSubjectId, 0 as updatedItem, 0 as newItem, 0 as carryOverItem, itemType + cast( skuId as varchar ) as catalogKey from qcf_dispInteractionProducts where itemType in ( 'PRD', 'SKU' ) select cast( round( / netWeight, 0 ) as integer ) as quantity_amt_in_cases from [tbl_DW_ProductHierarchy_#attributes.ownerType##attributes.ownerId#] where skuId = and 'SKU' = and nullif( netWeight, 0 ) is not null select stageId from tbl_SPL_Stages with (nolock) where ownerId = and ownerType = and statusCode = 'C' select stageId from tbl_SPL_Stages with (nolock) where ownerId = and ownerType = and statusCode = 'R' select stageId from tbl_SPL_Stages with (nolock) where ownerId = and ownerType = and likelihoodPercent >= and statusCode = 'A' order by likelihoodPercent select stageId from tbl_SPL_Stages with (nolock) where ownerId = and ownerType = and statusCode = 'A' order by likelihoodPercent desc ---> insert into tbl_CRM_InteractionSaleDetails ( ownerId, ownerType, interactionId, saleSubjectId, saleSubjectType, saleQty, saleDurationUnit, disposition, dispositionDate, dispositionUserId, noSaleReasonId, saleReasonId, comment, sampleStatus, sampleComments, typeCode, availableDate, stageId, annualCaseAmt, annualWeightAmt, annualDollarAmt, annualEUAmt, externalRef, updateDate ) values ( ,, , , , , , , , , , , , , , , , , , , , , , ) update tbl_crm_interactionsaledetails set disposition = , dispositionDate = , dispositionUserId = , saleqty = , saleDurationUnit = , nosalereasonid = , salereasonid = , comment = , sampleStatus = , sampleComments = , typeCode = , availableDate = , stageId = , annualCaseAmt = , annualWeightAmt = , annualDollarAmt = , annualEUAmt = , presented = 'Y', updateDate = , externalRef = , syncOppId = null, syncOppDate = null, syncOppUserId = null, syncOppMsg = null, syncOppStatus = null , sourceid = null, sourcetype = null ---> where ownerid = and ownertype = and interactionid = and interactiondetailid = update tbl_CRM_InteractionSaleDetails set disposition = 'FU', dispositionDate = , dispositionUserId = , presented = 'N' where ownerId = and ownerType = and interactionDetailId = delete from tbl_CRM_InteractionSaleDetails where ownerId = and ownerType = and interactionId = and saleSubjectType = 'MFR' ---> select * from qcf_dispInteractionProducts where disposition = 'FU' select top 1 skuId, mfr_id from tbl_DW_ProductHierarchy_#attributes.ownerType##attributes.ownerId# with (nolock) where 1 = 1 and skuId = and mfr_id = and sku = and mfr_id = select reasonId from [#_reasonTable#] with (nolock) where ownerId = and ownerType = and [#_reasonColumn#] = select interactionId, disposition, interactionDate, dispositionDate, partnerId, partnerType, ( select d.interactionDetailId, d.saleSubjectId, d.saleSubjectType, d.disposition, d.saleQty, d.presented, d.dispositionDate, d.dispositionUserId from tbl_CRM_interactionSaleDetails d with (nolock) where d.ownerId = i.ownerId and d.ownerType = i.ownerType and d.interactionId = i.interactionId for json auto, include_null_values ) as lines from tbl_CRM_Interactions i with (nolock) where i.interactionId = and i.ownerId = and i.ownerType = for json auto, include_null_values, without_array_wrapper