update i set eai_batchId = eai_batchId * -1 from tbl_IMPORT_Distributors i inner join tbl_IMPORT_Exclusions x on x.ownerId = i.ownerId and x.ownerType = i.ownerType and x.exclusionType = 'CDR' and x.exclusionId = i.company_id where i.ownerId = and i.ownerType = and i.eai_batchId = update tbl_IMPORT_Distributors set company_type = , recordSource = where ownerId = and ownertype = and eai_batchid = update i set i.fse_partnerId = cdr.cdr_recordId from tbl_IMPORT_Distributors i inner join tbl_CDR_Distributors cdr on cdr.ownerId = i.ownerId and cdr.fsl_tablecode = i.ownerType and cdr.cdr_dstCode = i.company_id where i.ownerId = and i.ownertype = and i.eai_batchid = select distinct ownerId, ownerType, recordSource, company_id, company_name, company_type, company_classification, territory_name_id, company_phone, company_address1, company_address2, company_city, company_state, company_zip, company_last_modify_date, focus_company_indicator from tbl_IMPORT_Distributors i where i.eai_batchId = and i.ownerId = and i.ownerType = and i.fse_partnerId is null select classificationId from qmd_classifications where name = No classification for #company_classification# - #company_id#
set nocount on insert into tbl_CDR_Distributors ( ownerId, fsl_tablecode, cdr_dstcode, cdr_dstname, cdr_dstaddress1, cdr_dstaddress2, cdr_dstcity, cdr_dststate, cdr_dstzip, recordSource, createDate, lastUpdated, setMethod, focusAccount ) values ( , , , , , , , , , , { fn now() }, , 1, ) select partnerId = @@identity set nocount off update tbl_IMPORT_Distributors set fse_partnerId = where company_id = and eai_batchId = and ownerId = and ownerType = update tbl_CDR_Distributors set cdr_dstcode = , crmActive = 'Y' where cdr_recordId = and ownerId = and fsl_tablecode =
select eai_importId, ownerId, ownerType, fse_partnerId, fse_contactId, recordSource, contact_last_name, contact_first_name, contact_fax, contact_phone, contact_mobile_phone, contact_email, contact_last_modify_date, primary_contact_indicator, contact_title, contact_job_function from tbl_IMPORT_Distributors ci where ci.ownerId = and ci.ownerType = and ci.eai_batchId = and ci.fse_partnerId is not null and ci.fse_contactId is null select jobFunctionId from qmd_partnerContactJobFunctions where jobFunctionName = set nocount on insert into tbl_FSPro_members ( firstName, lastName, email, phone, fax, cellPhone, officeAddrSame, createDate, lastUpdated, originalSource, orgId, orgType, ownerId, fsl_tablecode, title, cajobfunction ) values( , , , , , , 1, { fn now() }, , , , , , , , ) select contactId = @@identity set nocount off update tbl_CDR_Distributors set primaryContactId = where cdr_recordId = update tbl_IMPORT_Distributors set fse_contactId = where eai_importId = update cdr set cdr.cdr_territoryId = t.territoryId from tbl_IMPORT_Distributors i inner join tbl_CDR_Distributors cdr on cdr.cdr_recordId = i.fse_partnerId and cdr.ownerId = i.ownerId and cdr.fsl_tablecode = i.ownerType and cdr.setMethod = 1 left outer join tbl_TER_Territories mappedTerritory on mappedTerritory.territoryId = cdr.cdr_territoryId and mappedTerritory.ownerId = cdr.ownerId and mappedTerritory.fsl_tablecode = cdr.fsl_tablecode inner join tbl_TER_Territories t on t.ownerId = i.ownerId and t.fsl_tablecode = i.ownerType and t.internalSalesId = i.territory_name_id where i.ownerId = and i.ownertype = and i.eai_batchid = and mappedTerritory.territoryId is null update cdr set cdr.cdr_territoryId = t.territoryId from tbl_IMPORT_Distributors i inner join tbl_CDR_Distributors cdr on cdr.cdr_recordId = i.fse_partnerId and cdr.ownerId = i.ownerId and cdr.fsl_tablecode = i.ownerType and cdr.setMethod = 1 left outer join tbl_TER_Territories mappedTerritory on mappedTerritory.territoryId = cdr.cdr_territoryId and mappedTerritory.ownerId = cdr.ownerId and mappedTerritory.fsl_tablecode = cdr.fsl_tablecode inner join tbl_TER_Territories t on t.ownerId = i.ownerId and t.fsl_tablecode = i.ownerType and t.name = i.territory_name_id where i.ownerId = and i.ownertype = and i.eai_batchid = and mappedTerritory.territoryId is null #summaryHTML#