SQL: trucs et astuces

Merge

MERGE INTO Table1 T1
  USING (SELECT Id, Meschamps FROM Table2) T2
    ON ( T1.Id = T2.Id ) -- Condition de correspondance
WHEN MATCHED THEN -- Si Vraie
  UPDATE SET T1.Meschamps = T2.Meschamps
WHEN NOT MATCHED THEN -- Si faux
  INSERT (T1.ID, T1.MesChamps) VALUES ( T2.ID, T2.MesChamps);