update tbl_IMPORT_PrincipalKPIs set fsePrincipalId = where ownerType = and ownerId = and eai_batchId = select mfr_territory_nbr, mfr_territory_name, fsePrincipalId, eai_importId, eai_lineNumber, fseMessage from tbl_IMPORT_PrincipalKPIs where ownerType = and ownerId = and eai_batchId = select principalTerritoryId from tbl_BRO_PrincipalTerritories where ownerType = and ownerId = and principalId = and mfrTerritoryNbr = update tbl_IMPORT_PrincipalKPIs set fsePrincipalTerritoryId = , fseMessage = where ownerType = and ownerId = and eai_batchId = and eai_importId = and eai_lineNumber = select pkc.kpiName, pkc.kpiId, pkc.kpiRank from tbl_BRO_PrincipalKPICodes pkc where pkc.ownerId = and pkc.ownertype = and pkc.principalId = select mfr_kpi, fsePrincipalId, eai_importId, eai_lineNumber, fseMessage from tbl_IMPORT_PrincipalKPIs where ownerType = and ownerId = and eai_batchId = update tbl_IMPORT_PrincipalKPIs set fseKPIId = , fseMessage = where ownerType = and ownerId = and eai_batchId = and eai_importId = and eai_lineNumber = select eai_LineNumber, fiscal_year, fiscal_week, fsePrincipalTerritoryId, fsePrincipalId, fseKPIId, actual_ytd, budget_ytd, annual_budget, fseMessage, m.mfr_name, pt.mfrTerritoryNbr, pt.mfrTerritoryName, pkc.kpiName, mfr_territory_nbr, mfr_territory_name, mfr_kpi, fseValidPeriod from tbl_IMPORT_PrincipalKPIs pb left outer join tbl_BRO_principalTerritories pt on pt.principalTerritoryId = pb.fsePrincipalTerritoryId and pt.ownerId = pb.ownerId and pt.ownerType = pb.ownerType left outer join tbl_BRO_Principals p on p.principalId = pb.fsePrincipalId and p.ownerid = pb.ownerId and p.ownerType = pb.ownerType left outer join tblManufacturers m on m.mfr_id = p.mfrId left outer join tbl_BRO_PrincipalKPICodes pkc on pkc.kpiId = pb.fseKPIId and pkc.ownerId = pb.ownerId and pkc.ownerType = pb.ownerType where pb.ownerType = and pb.ownerId = and pb.eai_batchId = order by mfr_territory_nbr, mfr_territory_name, mfr_kpi select * from tbl_IMPORT_PrincipalKPIs pb where pb.ownerType = and pb.ownerId = and pb.eai_batchId = and ( coalesce( fsePrincipalTerritoryId, 0 ) = 0 or coalesce( fsePrincipalId, 0 ) = 0 or coalesce( fseKPIId, 0 ) = 0 or coalesce( fseMessage, '' ) <> '' ) select * from qmd_import order by eai_lineNumber
#htmleditformat( mfr_name )# #htmleditformat( _errorTxt )#
Line ## Terr. ## Terr. Name KPI Actuals YTD Budget YTD Annual Budget Messages
#lsnumberformat( eai_lineNumber, "0000" )# #htmleditformat( mfr_territory_nbr )# #htmleditformat( mfr_territory_name )# #htmleditformat( kpiName )# #lsnumberformat( actual_ytd, ",9.9999" )# #lsnumberformat( budget_ytd, ",9.9999" )# #lsnumberformat( annual_budget, ",9.9999" )#
Processed
#htmleditformat( _messageText )#
#_resultsHTML#
Batch ID: #lsnumberformat( qmd_batch.batchId, "0000000" )# Status: #_results.status# #_results.message#
#_resultsHTML#
set nocount on update tbl_BRO_PrincipalKPIs set actualYTD = , budgetYTD = , annualBudget = , lastUpdated = , lastUpdatedBy = where ownerId = and ownerType = and principalId = and principalTerritoryId = and kpiId = select rowsAffected = @@rowCount set nocount off insert into tbl_BRO_PrincipalKPIs ( ownerId, ownerType, principalId, principalTerritoryId, kpiId, actualYTD, budgetYTD, annualBudget, lastUpdated, lastUpdatedBy ) values ( , , ,, , , , , , )