How to use T-SQL MERGE in this case?
- by abatishchev
I'm new to T-SQL command MERGE so I found a place in my SQL logic where I can use it and want to test it but can't figure out how exatcly should I use it:
IF (EXISTS (SELECT 1 FROM commissions_history WHERE request = @requestID))
UPDATE commissions_history
SET amount = @amount
WHERE request = @requestID
ELSE
INSERT INTO…