MERGE -v- UPSERT

Posted by Kevin Ross on Stack Overflow See other posts from Stack Overflow or by Kevin Ross
Published on 2010-03-22T14:00:11Z Indexed on 2010/03/22 14:01 UTC
Read the original article Hit count: 455

Filed under:
|

Hi,

I have an application I’m writing in access with a SQL server backend. One of the most heavily used parts is where the users selects an answer to a question, a stored procedure is then fired which sees if an answer has already been given, if it has an UPDATE is executed, if not an INSERT is executed.

This works just fine but now we have upgraded to SQL server 2008 express I was wondering if it would be better/quicker/more efficient to rewrite this SP to use the new MERGE command.

Does anyone have any idea if this is faster than doing a SELECT followed by either an INSERT or UPDATE?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-2008