update cd set, cd.[#_field#] = from tbl_OPR_ClientChainDistribution cd where cd.ownerId = and cd.ownerType = and cd.chainOperatorId = and cd.territoryId = select opr.seasonOpenDate, opr.seasonCloseDate, opr.seasonType from tbl_OPR_ClientOperators opr where opr.ownerId = and opr.fsltablecode = and opr.operatorId = update opr set, opr.[#_field#] = 10 from tbl_OPR_ClientOperators opr where opr.ownerId = and opr.fsltablecode = and opr.operatorId = update tbl_OPR_ClientOperators set chainHQUnitNotes = , unitsFollowSegment = , unitsFollowCuisine = , unitsFollowSeasonality = where operatorId = and ownerId = and fsltablecode = delete from tbl_OPR_ClientChainDistribution where ownerId = and ownerType = and chainOperatorId = select * from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'CMC' select * from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'CMC' delete from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'CMC' insert into tbl_CRM_Affiliations ( ownerId, ownerType, affiliationType, orgId, orgType, affiliationDate, deaffiliationDate, affiliationStatus, partnerId, partnerType, partnerAffiliateNbr, sourceId, sourceType, busName, busUnitName, busAddr1, busAddr2, busAddr3, busCity, busState, busPostalCode, sortRank, businessRole, membershipQualificationId ) values ( , , , , , , , , , , , , , , , , , , , , , , , ) select orgId, orgType, affiliationType, sortRank, partnerAffiliateNbr, affiliationDate, affiliationId, 'N' updated, coalesce( businessRole, affiliationType ) businessRole from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = '#_affiliationType#' and ( businessRole = '#_businessRole#' or businessRole is null ) and affiliationType = '#_affiliationType#' and businessRole = '#_businessRole#' update a set partnerAffiliateNbr = , affiliationDate = , affiliationStatus = 'A', sortRank = , businessRole = from tbl_CRM_Affiliations a where a.affiliationId = insert into tbl_CRM_affiliations ( ownerId, ownerType, partnerId, partnerType, affiliationType, orgId, orgType, partnerAffiliateNbr, affiliationDate, affiliationStatus, sourceId, sourceType, sortRank, businessRole ) values ( , , , , , , , , , , , 'USR', , ) delete from tbl_CRM_Affiliations where affiliationId = and ownerId = and ownerType = select coalesce( nullif( opr.dbaName, '' ), opr.companyName ) affiliationCompanyName, coalesce( nullif( cho.cho_dbaname, '' ) , cho.cho_name ) fslCompanyName from tbl_CRM_Affiliations a inner join tbl_OPR_ClientOperators opr on opr.operatorId = a.orgId left outer join tbl_CHO_Operators cho on cho.cho_id = opr.fsl_choid where a.ownerId = and a.ownerType = and a.partnerId = and a.partnerType = 'OPR' and a.affiliationType = '#_affiliationType#' order by a.sortRank, a.affiliationId update tbl_OPR_ClientOperators set #_affiliationType#CompanyName = , #_affiliationType#FSLCompanyName = where operatorId = select * from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'GPO' select * from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'GPO' delete from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = 'GPO' insert into tbl_CRM_Affiliations ( ownerId, ownerType, affiliationType, orgId, orgType, affiliationDate, deaffiliationDate, affiliationStatus, partnerId, partnerType, partnerAffiliateNbr, sourceId, sourceType, busName, busUnitName, busAddr1, busAddr2, busAddr3, busCity, busState, busPostalCode, sortRank, businessRole, membershipQualificationId ) values ( , , , , , , , , , , , , , , , , , , , , , , , ) select orgId, orgType, affiliationType, sortRank, partnerAffiliateNbr, affiliationDate, affiliationId, 'N' updated, coalesce( businessRole, affiliationType ) businessRole from tbl_CRM_Affiliations where ownerId = and ownerType = and partnerId = and partnerType = 'OPR' and affiliationType = '#_affiliationType#' and ( businessRole = '#_businessRole#' or businessRole is null ) and affiliationType = '#_affiliationType#' and businessRole = '#_businessRole#' update a set partnerAffiliateNbr = , affiliationDate = , affiliationStatus = 'A', sortRank = , businessRole = from tbl_CRM_Affiliations a where a.affiliationId = insert into tbl_CRM_affiliations ( ownerId, ownerType, partnerId, partnerType, affiliationType, orgId, orgType, partnerAffiliateNbr, affiliationDate, affiliationStatus, sourceId, sourceType, sortRank, businessRole ) values ( , , , , , , , , , , , 'USR', , ) delete from tbl_CRM_Affiliations where affiliationId = and ownerId = and ownerType = select coalesce( nullif( opr.dbaName, '' ), opr.companyName ) affiliationCompanyName, coalesce( nullif( cho.cho_dbaname, '' ) , cho.cho_name ) fslCompanyName from tbl_CRM_Affiliations a inner join tbl_OPR_ClientOperators opr on opr.operatorId = a.orgId left outer join tbl_CHO_Operators cho on cho.cho_id = opr.fsl_choid where a.ownerId = and a.ownerType = and a.partnerId = and a.partnerType = 'OPR' and a.affiliationType = '#_affiliationType#' order by a.sortRank, a.affiliationId update tbl_OPR_ClientOperators set #_affiliationType#CompanyName = , #_affiliationType#FSLCompanyName = where operatorId = update tbl_OPR_ClientOperators set unitNbr = , cuisineId = , oprSegment = , distrib1 = , buyingDecisions = , seasonOpenDate = , seasonCloseDate = , seasonType = where operatorId = and oprCompanyType = '0' and oprParentCo = and ownerId = and fsltablecode = update tbl_OPR_ClientOperators set chainHQUnitNotes = , unitsFollowSegment = , unitsFollowCuisine = , unitsFollowSeasonality = , unitsFollowCMC = , unitsFollowGPO = where operatorId = and oprCompanyType = '1' and ownerId = and fsltablecode =