SSC-EWI-SY0007

DML Derived Table not supported in Snowflake.

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Severity

High

Description

In Sybase, during execution, the DML statement specified in the dml-derived table is executed first, and the rows affected by that DML materialize into a temporary table whose columns are described by the REFERENCING clause. The temporary table represents the result set of dml-derived-table. Snowflake does not support this behavior.

Code Examples

Input Code:

IN -> Sybase_01.sql
SELECT * FROM (INSERT INTO TABLE1 (Col1, Col2) VALUES (1, 'test')) REFERENCING (FINAL AS F);
SELECT * FROM (DELETE FROM TABLE1) REFERENCING (FINAL AS F);
SELECT * FROM (UPDATE TABLE1 SET A = 1) REFERENCING (FINAL AS F);

Output Code:

OUT -> Sybase_01.sql
SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    INSERT INTO TABLE1 (Col1, Col2) VALUES (1, 'test')
  )
  REFERENCING
  (FINAL AS F);

SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    DELETE FROM TABLE1
  )
  REFERENCING
  (FINAL AS F);

SELECT
  *
FROM
  !!!RESOLVE EWI!!! /*** SSC-EWI-SY0007 - DML DERIVED TABLE NOT SUPPORTED IN SNOWFLAKE ***/!!!
  (
    UPDATE TABLE1
      SET
        A = 1
  )
  REFERENCING
  (FINAL AS F);

Recommendations

Last updated