The conversion for a regular UPDATE statement is very straightforward. Since the basic UPDATE structure is supported by default in Snowflake, the outliers are the parts where you are going to see some differences, check them in the Known Issues section.
SQL Server
IN -> SqlServer_01.sql
Update UpdateTest1Set Col1 =5;
Snowflake
OUT -> SqlServer_01.sql
Update UpdateTest1SetCol1 =5;
Cartesian Products
SQL Server allows add circular references between the target table of the Update Statement and the FROM Clause/ In execution time, the database optimizer removes any cartesian product generated. Otherwise, Snowflake currently does not optimize this scenario, producing a cartesian product that can be checked in the Execution Plan.\
To resolve this, if there is a JOIN where one of their tables is the same as the update target, this reference is removed and added to the WHERE clause, and it is used to just filter the data and avoid making a set operation.
SQL Server
IN -> SqlServer_03.sql
UPDATE [HumanResources].[EMPLOYEEDEPARTMENTHISTORY_COPY]SET BusinessEntityID = b.BusinessEntityID , DepartmentID = b.DepartmentID, ShiftID = b.ShiftID, StartDate = b.StartDate, EndDate = b.EndDate, ModifiedDate = b.ModifiedDate FROM [HumanResources].[EMPLOYEEDEPARTMENTHISTORY_COPY] AS a RIGHT OUTER JOIN [HumanResources].[EmployeeDepartmentHistory] AS bON a.BusinessEntityID = b.BusinessEntityID and a.ShiftID = b.ShiftID;
Snowflake
OUT -> SqlServer_03.sql
UPDATE HumanResources.EMPLOYEEDEPARTMENTHISTORY_COPY a SET BusinessEntityID = b.BusinessEntityID, DepartmentID = b.DepartmentID, ShiftID = b.ShiftID, StartDate = b.StartDate, EndDate = b.EndDate, ModifiedDate = b.ModifiedDate FROM HumanResources.EmployeeDepartmentHistory AS b WHERE HumanResources.EMPLOYEEDEPARTMENTHISTORY_COPY.BusinessEntityID = b.BusinessEntityID(+) AND HumanResources.EMPLOYEEDEPARTMENTHISTORY_COPY.ShiftID = b.ShiftID;