Insert
Translation reference for SQL Server Insert statement to Snowflake
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
Known Issues
1. Syntax elements that require special mappings:
[WITH common_table_expression]: Generates a temporal table alias to be used in the insert. Requires a transformation that involves RESULT_SCAN(), check MSCEWI4020 for more information.
[INTO]: This keyword is obligatory in Snowflake and should be added if not present.
2. Syntax elements not supported or irrelevant:
[TOP (expression) [PERCENT]]: Indicates the amount or percent of rows that will be inserted. Not supported.
[rowset_function_limited]: It is either OPENQUERY() or OPENROWSET(), used to read data from remote servers. Not supported.
[WITH table_hint_limited]: These are used to get reading/writing locks on tables. Not relevant in Snowflake.
[<OUTPUT Clause>]: Specifies a table or result set in which the inserted rows will also be inserted. Not supported.
[execute_statement]: Can be used to run a query to get data from. Not supported.
[dml_table_source]: A temporary result set generated by the OUTPUT clause of another DML statement. Not supported.
Related EWIs
MSCEWI4020: COMMON TABLE EXPRESSION IS NOT SUPPORTED FOR INSERT STATEMENT
MSCEWI1037: TRANSLATION FOR INSERT WITH DEFAULT VALUES IS PLANNED TO BE DELIVERED IN THE FUTURE
Last updated