Skip to content

Upsert

I must have been sleeping under a rock, but when did “Upsert” become a word? It refers to the combination of insert and update statements for a RDBMS. What it means is: add the row it does not exist, otherwise update the row using the primary key.

It would be cool if SQL Server had this feature. There have been a few times where it would have been useful, mainly with batch operations. In those cases, I wrote stored procedures to handle upsert operations. At the server level, it should be trivial to implement an upsert statement as opposed to manually coding it in SQL.

It caught my eye when I read Ashvini Sharma’s blog.