Insert
Translation reference for SQL Server Insert statement to Snowflake
Some parts in the output code are omitted for clarity reasons.
Description
Adds one or more rows to a table or a view in SQL Server. For more information regarding SQL Server Insert, check here.
Syntax comparison
The basic insert grammar is equivalent between both SQL languages. However there are still some other syntax elements in SQL Server that show differences, for example, one allows the developer to add a value to a column by using the assign operator. The syntax mentioned will be transformed to the basic insert syntax too.
For information about other special syntax elements in SQL Server like the ones shown in the below example please refer to the Known Issues section of this page.
Snowflake
SQL Server
Sample Source Patterns
Basic INSERT
SQL Server
Snowflake
INSERT with assing operator
SQL Server
Snowflake
INSERT with no INTO
SQL Server
Snowflake
INSERT with common table expression
SQL Server
Snowflake
INSERT with Table DML Factor with MERGE as DML
This case is so specific where the INSERT
statement has a SELECT
query, and the FROM
clause of the SELECT
mentioned contains a MERGE
DML statement. Looking for an equivalent in Snowflake, the next statements are created: a temporary table, the merge statement converted, and finally, the insert statement.