The Dixie Flatline (9/23/2016)
If you haven't read up on the MERGE operation in TSQL, be sure to do so. It allows you to insert and update (and d elete if need be) in a single query. Look at the sample queries HERE and try to adapt them to your issue.Hint: Example A is just what you're trying to do: Update where a row exists, and insert where a row doesn't exist.
If you have any questions, post your code up here and we'll have a look at it.
I prefer the individual commands rather than Merge. There have been too many problems with it for me to trust it.
--Jeff Moden
Change is inevitable... Change for the better is not.