I have a DTSX file that has an update statement that is selecting from itself in the update statement and it is filling up the temp DB. It is using parameter mapping for a variable in the update statement.
I rewrote it to first run the select statement into a temp table and then run the update statement, but I get the following error "Multiple-step OLE DB operation generated errors..."
I am not very familiar with SSIS packages and am wondering if I have written the statement incorrectly.
Below is the query. Notice the update statement at the bottom has the "?" in it, which I thought would get the parameter mapped to it.
if OBJECT_ID(N'tempdb..#QUERYCF') is not null
drop table #QUERYCF
go
select
cafi_key,
newfrequency.fr_key as cafi_freqkey,
newcarriercharge.cacr_key as cafi_carrierchargekey,
newcarrierrate.cara_key as cafi_carrierratekey
INTO #QUERYCF
from stg_fct_carrierfinancial
left outer join fin_dim_date chargedate
on cafi_chargedtkey = chargedate.dt_key
inner join fin_dim_carriercharge currentcarriercharge
on cafi_carrierchargekey = currentcarriercharge.cacr_key
inner join lkp_dim_carriercharge newcarriercharge
on currentcarriercharge.cacr_db_code = newcarriercharge.cacr_db_code
and currentcarriercharge.cacr_code = newcarriercharge.cacr_code
and chargedate.dt_epochday between newcarriercharge.cacr_stdt_epochday and newcarriercharge.cacr_endt_epochday
inner join fin_dim_frequency currentfrequency
on cafi_freqkey = currentfrequency.fr_key
inner join lkp_dim_frequency newfrequency
on currentfrequency.fr_db_code = newfrequency.fr_db_code
and currentfrequency.fr_pu_code = newfrequency.fr_pu_code
and currentfrequency.fr_code = newfrequency.fr_code
and chargedate.dt_epochday between newfrequency.fr_stdt_epochday and newfrequency.fr_endt_epochday
inner join fin_dim_carrierrate currentcarrierrate
on cafi_carrierratekey = currentcarrierrate.cara_key
inner join lkp_dim_carrierrate newcarrierrate
on currentcarrierrate.cara_db_code = newcarrierrate.cara_db_code
and currentcarrierrate.cara_code = newcarrierrate.cara_code
and chargedate.dt_epochday between newcarrierrate.cara_stdt_epochday and newcarrierrate.cara_endt_epochday
where cafi_deleteloadkey is null and
(
currentcarriercharge.cacr_mostrecentcode = 0 or
currentfrequency.fr_mostrecentcode = 0
)
GO
update stg_fct_carrierfinancial
set cafi_freqkey = newdata.cafi_freqkey,
cafi_carrierchargekey = newdata.cafi_carrierchargekey,
cafi_carrierratekey = newdata.cafi_carrierratekey,
cafi_modifyloadkey = ?
from stg_fct_carrierfinancial currentdata
inner join (select
cafi_key,
cafi_freqkey,
cafi_carrierchargekey,
cafi_carrierratekey
FROM #QUERYCF
) newdata
on currentdata.cafi_key = newdata.cafi_key
GO
drop table #QUERYCF
GO
Here is the full error message:
Build Facts (8/30/2019 10:40:25 PM)
Message: ExecutionID: Failure Code #-4001Source: Update obseleted dim keys in stg_fct_carrierfinancial SubComponent: Execute SQL Task ErrorCode: -1073548784 Description: Executing the query "
select cafi_key, newfrequency.fr_key as cafi_..." failed with the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Source: Update obseleted keys in stg_fct_startstoprestarttrans SubComponent: Execute SQL Task ErrorCode: -1073548784 Description: Executing the query "
select stsprstr_key, newfrequency.fr_key as s..." failed with the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Elapsed Time: 7800 secs Elapsed Time: 02:09:59 Return Code: -4001 (SSIS_EXECUTE_FAILURE)