select imp.* from tbl_IMPORT_PartnerContacts 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.fspro_userId and mem.orgType = imp.company_type where imp.eai_batchId = and imp.ownerId = and imp.ownerType = and imp.eai_lineNumber > 0 update tbl_IMPORT_PartnerContacts set fseUpdateStatus = 'M', fseContactId = where ownerId = and ownertype = and eai_batchid = and eai_lineNumber = and eai_importId = delete from tbl_FSPro_members where fspro_userId = and ownerId = and fsl_tableCode = and orgType = select imp.fspro_userId, imp.company_name, imp.contact_first_name, imp.contact_last_name, imp.contact_email,imp.fseUpdateStatus from tbl_IMPORT_PartnerContacts imp with (nolock) where imp.ownerId = and imp.ownerType = and imp.eai_batchId = and imp.fseUpdateStatus = 'M' and imp.fseContactId is not null select imp.fspro_userId, imp.company_name, imp.contact_first_name, imp.contact_last_name, imp.contact_email,imp.fseUpdateStatus from tbl_IMPORT_PartnerContacts imp with (nolock) where imp.ownerId = and imp.ownerType = and imp.eai_batchId = and imp.fseUpdateStatus is null and imp.fseContactId is null