Link to home
Start Free TrialLog in
Avatar of jknj72
jknj72

asked on

UPSERT in SSIS

I have an ERP system with an ORD_HDR(about a million rows) table and an ORD_DTL(about 7 million rows) table. Initially there was an ODBC connection to the ERP system and it was a query  on the ORD_HDR table with an INNER JOIN to the details table for the last 10 days with a Slowly Changing dimension to insert or update the table and then a bunch of Lookups and then loading a Fact table. This took over an hour and a half to run. So I loaded all the data into SQL tables and then want to use those tables to do the UPSERT. My initial problem is that I have to check the ERP data against my tables that are loaded already and do an Insert or Update if it exists already or not. I wanna do this the fastest way possible so Im open to suggestions. I have to query the ERP tables, match the records against the tables I loaded today and do an Insert if it doesnt exist and an Update if it does. I dont even beleive the Update is necessary but I guess it was necessary on the SCD I guess? Please help!!!
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jknj72
jknj72

ASKER

This may be exactly what Im looking for I just have to figure out how to write the syntax, I have like 200+ fields in my select statement. Can I just check like 3 source fields against 3 dest fields and then do the insert with all the columns? If this works I will buy you dinner!!!!
Avatar of jknj72

ASKER

Jim, do you have any experience with the Merge task in SSIS?
Avatar of jknj72

ASKER

Thanks for pointing me in the right direction. I have another question out there for how to do the Merge, if your interested