SSC-EWI-TS0044
FOR XML clause is not supported in Snowflake.
Severity
Critical
Description
This EWI is added for the FOR XML clause which is not supported in Snowflake SQL
Code Example
Input Code:
SELECT TOP 1 LastName
FROM AdventureWorks2019.Person.Person
FOR XML AUTO;
Output Code:
SELECT TOP 1
LastName
FROM
AdventureWorks2019.Person.Person
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0044 - FOR XML AUTO CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
FOR XML AUTO;
Recommendations
Consider using UDFs to emulate the behavior of the source code. The following code provides suggestions of UDFs that can be used to achieve recreating the original behavior:
SQL Server
CREATE TABLE TEMPTABLE (Ref INT, Des NVARCHAR(100), Qty INT)
INSERT INTO tempTable VALUES (100001, 'Normal', 1), (100002, 'Foobar', 1), (100003, 'Hello World', 2)
GO
-- FOR XML
SELECT *
FROM TempTable
FOR XML AUTO
GO
-- FOR XML RAW
SELECT *
FROM TempTable
FOR XML RAW
Snowflake
CREATE OR REPLACE TABLE TEMPTABLE (
Ref INT,
Des VARCHAR(100),
Qty INT
)
COMMENT = '{"origin":"sf_sc","name":"snowconvert","version":{"major":1, "minor":0},{"attributes":{"component":"transact"}}'
;
INSERT INTO tempTable VALUES (100001, 'Normal', 1), (100002, 'Foobar', 1), (100003, 'Hello World', 2);
-- FOR XML
SELECT
*
FROM
TempTable
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0044 - FOR XML AUTO CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
FOR XML AUTO;
-- FOR XML RAW
SELECT
*
FROM
TempTable
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0044 - FOR XML RAW CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
FOR XML RAW;
If you need more support, you can email us at snowconvert-support@snowflake.com
Last updated