Link to home
Start Free TrialLog in
Avatar of SQLSearcher
SQLSearcher

asked on

SSIS Update records if exist insert new record if not

Hello Experts Exchange
I need to develop a SSIS package that will update a table if a record exists, if a record does not exist then insert the record.

However if a record does exits and only update the record if the field Verified is null and the field Populated = Y.

I think I need to use a Foreach Loop Container to be able to do this check on each record, but I don't know how to configure.

How would I configure the SSIS package to do this?

Regards

SQLSearcher
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

I assume you are using a Lookup task to determine if the record exists.  Just route the Match Output to a Conditional Split Task to check the Verified and Populated table and send those rows to an OLEDB command task to update the records.

If you need more detail on how to set these up let me know.
Avatar of SQLSearcher
SQLSearcher

ASKER

Hi Brian
Can you provide more detail please?

Regards

SQLSearcher
Here is an image of part of a package that I use.  It is performing a lookup on dimProject and sending all matched data to the Conditional Split which is pictured below in more detail.  My example is comparing checksum values but you could easily change it to check your Verified and Populated values.

Hopefully this makes it a little clearer.

 User generated image
User generated image
Some detailed instructions on how to use the Conditional Split task:

https://www.simple-talk.com/sql/ssis/ssis-basics-using-the-conditional-split/
Hello Brian
How do I setup the Update can you provide more information please?

Regards

SQLSearcher
ASKER CERTIFIED SOLUTION
Avatar of Brian Crowe
Brian Crowe
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
Thank you for your help.