how to call stored procedure from SSIS? -
i want create ssis package call stored procedure , dump output of procedure table.
ssis package return output , need resultset ouput dump table. before inserting want update rows tables if rows exist date or insert resultset.
i do't quite understand requirements way:
drop on execute sql task
ensure
yourstagingtable
exists , columns match stored procedure output
here sample code put in execute sql task want:
-- clear staging table truncate yourstagingtable -- save results of stored proc staging table insert yourstagingtable exec yourproc -- update existing records update yourfinaltable set yourupdatefield = yourstagingtable.yoursourcefield yourstagingtable yourfinaltable.joinfield1 = yourstagingtable.joinfield1 -- insert non existing records insert yourfinaltable (column1,column2) select column1,column2 yourstagingtable not exists ( select 1 yourfinaltable yourfinaltable.joinfield1 = yourstagingtable.joinfield1 )
Comments
Post a Comment