MSCEWI3030

KEEP statement used to indicate that only the first or last values of the aggregate function will be returned is not supported

This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.

Severity

Medium

Description

This error appears to advertise that the KEEP statement used to indicate that only the first or last values of the aggregate function will be returned is not supported

Example Code

Input Code:

SELECT MIN(salary) OVER (PARTITION BY name ORDER BY id) OVER(PARTITION by salary) FROM TABLE1;
KEEP (DENSE_RANK FIRST ORDER BY commission DESC NULLS FIRST) 

Output Code:

SELECT
/*** MSC-ERROR - MSCEWI3030 - KEEP STATEMENT USED TO INDICATE THAT ONLY THE FIRST OR LAST VALUES OF THE AGGREGATE FUNCTION WILL BE RETURNED IS NOT SUPPORTED ***/
MIN(salary) OVER(PARTITION BY name ORDER BY id) /*KEEP(DENSE_RANK FIRST ORDER BY commission DESC NULLS FIRST,) OVER(PARTITION by salary, )*/ FROM PUBLIC.test_table;

Recommendations

Last updated