SSC-FDM-TS0005

TRY_CONVERT/TRY_CAST could not be converted to TRY_CAST

circle-info

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentationarrow-up-right

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected]envelope.

Thank you for your understanding.

Description

This FMD is added when a TRY_CONVERT or TRY_CAST cannot be converted to a TRY_CAST in Snowflake.

Snowflake's TRY_CASTarrow-up-right function has a limitation as it only allows the conversion of string expressions. However, Transact's TRY_CONVERT and TRY_CAST functions allow any data type expression.

Currently, the transformation from TRY_CONVERT or TRY_CAST to Snowflake's TRY_CAST is only performed for string expressions or expressions that the tool can identify as strings in its context.

Code Example

Input Code:

IN -> SqlServer_01.sql
SELECT TRY_CAST(14.85 AS INT);
SELECT TRY_CONVERT(VARCHAR, 1234);
SELECT TRY_CONVERT(CHAR, 1);
SELECT TRY_CONVERT(SQL_VARIANT, '2017-01-01 12:00:00');
SELECT TRY_CONVERT(GEOGRAPHY, 'LINESTRING(-122.360 47.656, -122.343 47.656 )');

Output Code:

Recommendations

Last updated