SSC-EWI-TS0043
WITH XMLNAMESPACES is not supported in Snowflake.
Severity
Medium
Description
This EWI is added fort the WITH XMLNAMESPACES clause which is not supported in Snowflake SQL
Code Example
Input Code:
WITH XMLNAMESPACES ('uri' as ns1)
SELECT ProductID as 'ns1:ProductID',
Name as 'ns1:Name',
Color as 'ns1:Color'
FROM Production.Product
WHERE ProductID = 316
FOR XML RAW, ELEMENTS XSINIL
Output Code:
--** SSC-PRF-TS0001 - PERFORMANCE WARNING - RECURSION FOR CTE NOT CHECKED. MIGHT REQUIRE RECURSIVE KEYWORD **
WITH
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0043 - WITH XMLNAMESPACES IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
XMLNAMESPACES ('uri' as VARIANT /*** SSC-FDM-TS0015 - DATA TYPE NS1 IS NOT SUPPORTED IN SNOWFLAKE ***/)
SELECT
ProductID AS "ns1:ProductID",
Name AS "ns1:Name",
Color AS "ns1:Color"
FROM
Production.Product
WHERE
ProductID = 316
!!!RESOLVE EWI!!! /*** SSC-EWI-TS0044 - FOR XML RAW CLAUSE IS NOT SUPPORTED IN SNOWFLAKE ***/!!!
FOR XML RAW, ELEMENTS XSINIL;
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:
CREATE TABLE PRODUCT (ProductID INTEGER, Name VarChar(20), Color VarChar(20));
INSERT INTO PRODUCT(PRODUCTID, NAME, COLOR) VALUES(1,'UMBRELLA','RED');
INSERT INTO PRODUCT(PRODUCTID, NAME, COLOR) VALUES(2,'SHORTS','BLUE');
INSERT INTO PRODUCT(PRODUCTID, NAME, COLOR) VALUES(3,'BALL','YELLOW');
WITH XMLNAMESPACES ('uri' as ns1)
SELECT ProductID as 'ns1:ProductID',
Name as 'ns1:Name',
Color as 'ns1:Color'
FROM Product
FOR XML RAW
If you need more support, you can email us at snowconvert-support@snowflake.com
Related EWI
SSC-PRF-TS0001: Performance warning - recursion for CTE not checked. Might require a recursive keyword.
SSC-EWI-TS0044: FOR XML clause is not supported in Snowflake.
SSC-FDM-TS0015: Regexp_Substr Function only supports POSIX regular expressions.
Last updated