MSCEWI4019

CROSS APPLY not supported

Severity

Medium

Description

This error message is added when SnowConvert finds a CROSS APPLY. APPLY is not supported in Snowflake and the behavior of CROSS APPLY without it, is not the intended behavior that the original code had. For this reason, the entire CROSS APPLY statement is commented out.

Code Example

Input code:

UPDATE some_table
SET some_row = A.another_row,
    some_row2 = A.another_row/2
FROM some_table st
RIGHT JOIN some_table2 st2
ON 1=1
CROSS APPLY
    (SELECT TOP 1 another_row FROM another_table at WHERE at.shared_id=st.shared_id) AS A;

Output code:

UPDATE
MYDB.PUBLIC.some_table
SET some_row = A.another_row, some_row2 = A.another_row /2 FROM
-- ** MSC-ERROR - MSCEWI4019 - CROSS APPLY CLAUSE IS NOT SUPPORTED **
--                                                                MYDB.PUBLIC.some_table st
--RIGHT JOIN MYDB.PUBLIC.some_table2 st2
--ON 1=1
--CROSS APPLY
--    (SELECT TOP 1 another_row FROM MYDB.PUBLIC.another_table at WHERE at.shared_id = st.shared_id) AS A
                                                                                                       ;

Recommendations