List of articles   Terminology   Choose language


Abbreviated syntax of 'merge'


I propose to write

merge a from b where @a1=@b1
  set  @a2=@b2, @a3=@a3+@b3
  ins (@a4,@a5) values (@b4,@b5);
instead of bulky expression
merge into a using select ... from b on @a1=@b1
when     matched then update set @a2=@b2, @a3=@a3+@b3
when not matched then insert    (@a4,@a5) values (@b4,@b5);

Dmitry Turin



List of articles   Terminology   Choose language