Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
merge [target] t
using [source] s on t.id = s.id
when matched then 0update t.name = s.name, t.age = s.age -- use "rowset1"
when not matched then insert values(id,name,age) -- use "rowset2"
when source not matched then 0delete. -- use "rowset3"