MSCEWI3036

Types resolution issues, the arithmetic operation may not behave correctly between string and date.

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

Severity

Low

Description

This issue happens when an arithmetic operation may not behave correctly between two certain data types.

Example Code

Input Code:

-- Given the following table
CREATE TABLE TIMES(
AsDate Date,
AsIntervalDaySecond varchar(20)
);

-- An arithmetic operation between two data types that may not behave correctly
SELECT TIMES.AsIntervalYearMonth + TIMES.AsDate FROM TIMES;

Output Code:

-- Given the following table
CREATE OR REPLACE TABLE PUBLIC.TIMES (
AsDate Date,
AsIntervalDaySecond varchar(20));

-- An arithmetic operation between two data types that may not behave correctly
SELECT

/*** MSC-WARNING - MSCEWI3036 - TYPES RESOLUTION ISSUES, ARITHMETIC OPERATION '+' MAY NOT BEHAVE CORRECTLY BETWEEN String AND Date ***/
 TIMES.AsIntervalDaySecond + TIMES.AsDate FROM PUBLIC.TIMES;

Note that the operation between a String and Date may not behave correctly.

Recommendations

Last updated