4 ms·
One of MERGEs goals is to be the ANSI standard for "Upsert" queries, yes, ("On Conflict Do Update" is not standardized) but it's also a more powerful tool than
by WorldMaker 5y ago
One of MERGEs goals is to be the ANSI standard for "Upsert" queries, yes, ("On Conflict Do Update" is not standardized) but it's also a more powerful tool than that. It's almost a full bulk ETL tool allowing for some complex multi-table join-based bulk INSERT/UPDATE/DELETE (all at once).
(With great power comes great responsibility; as others point out MERGE in SQL Server can get you big table deadlocks if you aren't careful, but on the flipside in my experience there were a lot of very hairy stored procedures I was able to rewrite as single much easier to read MERGE statements that had far better query plans and were much faster overall.)