select distinct salesrep_email_address from tbl_IMPORT_SalesRepBudgets where ownerId = and ownertype = and eai_batchId = and nullif( salesRep_email_address, '' ) is not null select fspro_userId from tbl_fspro_members where staffMember = 1 and ownerId = and fsl_tablecode = and email = update tbl_IMPORT_SalesRepBudgets set fseFSPRO_UserId = where ownerId = and ownertype = and eai_batchId = and salesRep_email_address = select sales_year, sales_month, salesRep_email_address, #_budgetColumn# forecast_qty, fseFspro_userId from tbl_IMPORT_SalesRepBudgets where ownerId = and ownertype = and eai_batchId = and fseFspro_userid > 0 and sales_month between 1 and 12 update tbl_MFR_TPF_Detail#_tpfSuffix# set forecast_qty = where mfr_id = and forecast_year = and forecast_month = and forecast_status = 'Q' and tPartnerId = and tPartnerType = 'USR' insert into tbl_MFR_TPF_Detail#_tpfSuffix# ( mfr_id, forecast_year, forecast_month, forecast_status, tpartnerId, tPartnerType, forecast_qty, productItemCode, productLevel ) values ( , , , 'Q', , 'USR', , 'USR_#fseFspro_UserId#', 'USR' )