Adding conditional Update if already exists or Insert
Hi, Do you have any idea how I could modify that query to not only do inserts, but to first check if a record exists, and update it and if not then insert.
I've done that with a single row updates like this:
SET search_dt = GETDATE()
WHERE cc_id = #cc_id#
AND zip = '#getCustomer.zip#'
IF @@ROWCOUNT = 0
INSERT INTO tracking
(cc_id, zip, search_dt)
(#cc_id#, '#getCustomer.zip#', GETDATE())
But I have no idea how to combine the loading from XML part with this type of logic or even if that's possible...