Not a Sunday
select top 1 batchId, batchTime from tbl_EAI_InboundBatches with (nolock) where ownerId = and ownerType = and fileFormat = '$KELLANOVA_CONTACT_EXPORT' and batchTime < order by batchTime desc delete from tbl_EXPORT_Kellanova_Contact where ownerId = and ownertype = and eai_batchId = insert into tbl_EXPORT_Kellanova_Contact(ownerId, ownerType, eai_batchId, eai_lineNumber, firstname, lastname, salutation ,jobtitle, phone, mobilephone, email, facebook, instagram, address ,street_address_2, city, state, zip, job_role_function, novalytics_contact_id, customer_type, novalytics_customer_id) select ownerId, ownerType, #qmd_batch.batchId# as eai_batchId, row_number() over( order by partnerId,fspro_userId ) as eai_lineNumber, firstname, lastname, salutation, title, phone, cellphone , email, facebook, instagram, address1, address2, city, state, zipCode, caJobFunctionText,fspro_userId , CASE WHEN partnertype = 'OPR' THEN 'Operator' WHEN partnertype = 'CDR' THEN 'Distributor' END AS partnertype , partnerId from tbl_DW_CRMContacts_MFR207 with (nolock) where email > '' order by partnerId,fspro_userId update tbl_EAI_InboundBatches set loadedColumns = 'firstname,lastname,salutation,jobtitle, phone,mobilephone,email,facebook,instagram,address,street_address_2,city,state,zip,job_role_function,customer_type' where ownerId = and ownertype = and batchId =
Exported #lsnumberformat( _exportCount )# Contacts updated on or after #lsdateFormat( _cutoffDate, "MM/dd/yyyy" )#.
select * from tbl_EXPORT_Kellanova_Contact with (nolock) where ownerId = and ownertype = and eai_batchId = order by eai_lineNumber