update tmp set tmp.prod_mfrid = , tmp.sku_mfrid = from tbl_IMPORT_ProductData tmp where tmp.ownerType = and tmp.ownerId = and tmp.eai_batchId = update stage set stage.sku_mfrID = bpc.objectId, stage.prod_mfrID = bpc.objectId from tbl_IMPORT_ProductData stage inner join tbl_IMPORT_Aliases bpc on stage.mfr_mfrName = bpc.alias and bpc.ownerid = stage.ownerId and bpc.ownerType = stage.ownerType where stage.eai_batchid = and stage.ownerid = and stage.ownerType = and bpc.objectType = 'MFRID' with Level1Results as ( select distinct tmp.mfr_mfrName MFR_Name, s.skuid, s.sku, s.skuDesc, s.profitabilityRank as old_profitabilityRank, tmp.custom_6 as new_profitabilityRank from tbl_IMPORT_ProductData tmp inner join tbl_PRD_Skus s on s.skuId = tmp.sku_skuId and s.ownerid = tmp.ownerid and s.fsl_TableCode = tmp.ownerType where tmp.eai_batchid = and tmp.ownerid = and tmp.ownerType = and tmp.custom_6 in () and coalesce(tmp.sku_skuId,0) > 0 ) select * from Level1Results order by MFR_Name, sku; update s set s.profitabilityRank = tmp.custom_6 from tbl_IMPORT_ProductData tmp inner join tbl_PRD_Skus s on s.skuId = tmp.sku_skuId and s.ownerid = tmp.ownerid and s.fsl_TableCode = tmp.ownerType where tmp.eai_batchid = and tmp.ownerid = and tmp.ownerType = and tmp.custom_6 in () and coalesce(tmp.sku_skuId,0) > 0

SKU_PROFITABILITY_IMPORT Results

select distinct tmp.mfr_mfrName MFR_Name from tbl_IMPORT_ProductData tmp where tmp.eai_batchid = and tmp.ownerid = and tmp.ownerType = and nullif(tmp.prod_mfrId,0) is null and nullif(tmp.mfr_mfrName,'') is not null select distinct tmp.mfr_mfrName MFR_Name, tmp.sku_sku, tmp.sku_skuDesc from tbl_IMPORT_ProductData tmp where tmp.eai_batchid = and tmp.ownerid = and tmp.ownerType = and nullif(tmp.sku_skuId,0) is null and ( nullif(tmp.sku_sku,'') is not null or nullif(tmp.sku_skuDesc,'') is not null ) order by tmp.mfr_mfrName, tmp.sku_sku select distinct tmp.mfr_mfrName MFR_Name, tmp.sku_skuId, tmp.sku_sku, tmp.sku_skuDesc, tmp.custom_6 as Rejected_SkuProbability from tbl_IMPORT_ProductData tmp where tmp.eai_batchid = and tmp.ownerid = and tmp.ownerType = and tmp.custom_6 not in () order by tmp.mfr_mfrName, tmp.sku_sku