{"blog_title":".log","author_name":"dotlog","height":"190","url":"https://dotlog.hatenadiary.org/entry/20100612/1276330107","blog_url":"https://dotlog.hatenadiary.org/","version":"1.0","published":"2010-06-12 17:08:27","categories":["SQLServer"],"type":"rich","width":"100%","author_url":"https://blog.hatena.ne.jp/dotlog/","image_url":null,"title":" MERGE\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdotlog.hatenadiary.org%2Fentry%2F20100612%2F1276330107\" title=\" MERGE\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8 - .log\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_url":"https://hatena.blog","description":"SQL Server 2008\u304b\u3089\u306e\u65b0\u6a5f\u80fd\u3002 (Oracle\u306b\u306f\u524d\u304b\u3089\u3042\u3063\u305f) MERGE table1 USING table2 ON ( table1.field1 = table2.field1 ) WHEN MATCHED THEN UPDATE SET table1.field2 = table2.field1 WHEN NOT MATCHED THEN INSERT ( field1, field2 ) VALUES ( table2.field1, table2.field2 ); \u300c\u30de\u30c3\u30c1\u3057\u306a\u3044\u3068\u304d\u3060\u3051\u8ffd\u52a0\u300d\u3057\u305f\u3044\u5834\u5408\u306fWHEN MATCHED THEN\u306e\u30d6\u30ed\u30c3\u30af\u3092\u306a\u304f\u305b\u3070\u3088\u3044\u2026"}