MSCEWI4054
Explicit cast to DATE added to return value.
This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.
Severity
Low
Description
This EWI is added when an input user defined function has DATE as its returning type. Its main purpose is informative.
In SQL Server it is possible to return a DATETIME value in a DATE-returning UDF. This is because SQL Server performs an implicit cast. In Snowflake, this is not the case, and compilation time errors may appear if a mismatch exists between the result type and the type stated by the UDF as its return type.
To avoid this, we add a:: DATE
cast to the result of the UDF, inside the outer SELECT statement of the output CTE. This way we ensure congruency between the stated return type and the actual returned value.
Code Example
Input Code:
Output Code:
Recommendations
If you need more support, you can email us at snowconvert-support@snowflake.com
Last updated