SSC-EWI-TS0026

With Delete Query turned to Create Table.

Severity

Low

Description

This EWI is added when a Common Table Expression With a Delete From is transformed to a Create or Replace Table.

Code Example

Input Code:

IN -> SqlServer_01.sql
WITH Duplicated AS (
SELECT *, ROW_NUMBER() OVER (PARTITION BY ID ORDER BY ID) AS RN
FROM WithQueryTest
)
DELETE FROM Duplicated
WHERE Duplicated.RN > 1

Output Code:

OUT -> SqlServer_01.sql
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0026 - WITH DELETE QUERY TURNED TO CREATE TABLE ***/!!!
CREATE OR REPLACE TABLE WithQueryTest AS
SELECT
*
FROM
WithQueryTest
QUALIFY
ROW_NUMBER()
OVER (PARTITION BY
ID
ORDER BY ID) = 1;

Recommendations

Last updated