Link Details

Link 67090 thumbnail
User 225256 avatar

By mswatcher
via blogs.msdn.com
Published: Feb 21 2008 / 11:11

This is a pretty common situation that comes up when performing database operations. A stored procedure is called and the data needs to be updated if it already exists and inserted if it does not.
  • 22
  • 0
  • 3078
  • 1000

Comments

Add your comment
User 241974 avatar

dkharlamov replied ago:

0 votes Vote down Vote up Reply

As far as I remember Oracle has MERGE to make it simple and convenient.

User 204981 avatar

reido56 replied ago:

0 votes Vote down Vote up Reply

And it's common to say "upsert" rather than "if exists update else insert".

User 275373 avatar

miah replied ago:

0 votes Vote down Vote up Reply

SQL Server 2008 will have the long awaited MERGE statement as well.

User 209577 avatar

LudoA replied ago:

0 votes Vote down Vote up Reply

What do mysql & postgresql have that compares to merge?

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.