Talk:Upsert
From Wikipedia, the free encyclopedia
Contents |
[edit] DB Specific examples
Should we put a few database specific examples for the most popular dbs?
[edit] MS Sql Server
update dbo.build_machine set build_machine=?,platform=?,site_code=?,adjust_time=? where build_machine=? if @@ROWCOUNT=0 insert into dbo.build_machine (build_machine,platform,site_code,adjust_time) values (?,?,?,?);
[edit] Oracle
INSERT FIRST WHEN credit_limit >=100000 THEN INTO rich_customers VALUES(cust_id,cust_credit_limit) INTO customers ELSE INTO customers SELECT * FROM new_customers;
[edit] MySQL
insert into t1(a, b, c) select d, e, f from t2 on duplicate key update b = e, c = f;

