I try to do a migration but i have problem with this query :
$DB->query("replace into periodetojour(idperiode,idjour,heure)
values('".addslashes($idperiode)."','2','".addslashes($mardi)."')");
I saw that REPLACE INTO can’t be used in SQL Server 2008 and that i hav to use MERGE INTO
My problem is that i don’t find any of my query which is working by using MERGE INTO so i am probably not using it well. Do you have any idea how can i change it with MERGE INTO and is it an obligation to change it in SQL Server 2008 ?
Thanks for your answer.
In your case, the
MERGEstatement would look like this:This is assuming that
idperiodeis your primary key. If the primary key is composed of(idperiode, idjour)you’ll have to adapt theONclause as well as theWHEN MATCHED THEN UPDATE SETclause accordingly: