select * from tbl_IMPORT_PartnerContacts with (nolock) where eai_batchId = and eai_lineNumber = 1 select distinct rec_type from tbl_IMPORT_PartnerURLS imp with (nolock) where imp.eai_batchId = and imp.ownerId = and imp.ownerType = and imp.eai_lineNumber > 0 select imp.* from tbl_IMPORT_PartnerURLS imp with (nolock) inner join tbl_FSPro_members mem with (nolock) on mem.ownerId = imp.ownerId and mem.fsl_tablecode = imp.ownerType and mem.fspro_userId = imp.fsl_id inner join tbl_OPR_ClientOperators opr with (nolock) on opr.operatorId = imp.fsl_id and opr.ownerId = imp.ownerId and opr.fslTableCode = imp.ownerType inner join tbl_CDR_Distributors cdr with (nolock) on cdr.cdr_recordId = imp.fsl_id and cdr.ownerId = imp.ownerId and cdr.fsl_TableCode = imp.ownerType where imp.eai_batchId = and imp.ownerId = and imp.ownerType = and imp.eai_lineNumber > 0 and imp.rec_type = update tbl_IMPORT_PartnerURLS set fseUpdateStatus = 'M', fsepartnerId = , fsepartnerType = where ownerId = and ownertype = and eai_batchid = and eai_lineNumber = and eai_importId = select imp.fsepartnerId, imp.fsepartnerType, imp.facebook, imp.instagram, imp.x as twitter, imp.tiktok, imp.youtube, imp.linkedin, case when fsePartnerType = 'USR' then 'CONTACT' else fsePartnerType end as rec_type from tbl_IMPORT_PartnerURLS imp with (nolock) where imp.ownerId = and imp.ownerType = and imp.eai_batchId = and imp.fseUpdateStatus = 'M' and imp.fsepartnerId is not null and imp.fsepartnerType is not null delete from tbl_CRM_PartnerURLs where ownerId = and ownerType = and partnerType = and partnerId = UPDATE tbl_FSPro_Members set LinkedIn = where fspro_userId = and ownerId = and fsl_tablecode = insert into tbl_CRM_PartnerURLs (ownerId, ownerType, partnerId, partnerType, urlType, urlValue) values ( , , , , , ) select imp.eai_importId, imp.ownerId, imp.ownerType, imp.facebook, imp.instagram, imp.x, imp.tiktok, imp.youtube, imp.linkedin, imp.fsepartnerId, imp.fsepartnerType from tbl_IMPORT_PartnerURLS imp with (nolock) where imp.ownerId = and imp.ownerType = and imp.eai_batchId = and imp.fseUpdateStatus is null and imp.fsepartnerId is null and imp.fsepartnerType is null

These rows did not match to an existing contact/ customer

select fsePartnerId as fsl_id, rec_type, case when youtube in () then youtube else '' end as youtube, case when x in () then x else '' end as x , case when facebook in () then facebook else '' end as facebook , case when instagram in () then instagram else '' end as instagram , case when tiktok in () then tiktok else '' end as tiktok , case when linkedin in () then linkedin else '' end as linkedin from tbl_IMPORT_PartnerURLS with (nolock) where ownerId = and ownerType = and eai_batchId = and ( youtube in () or x in () or facebook in () or instagram in () or tiktok in () or linkedin in () )