This is a deprecated version of the SnowConvert documentation, please visit the official site HERE.
Severity
Low
Description
This Warning is added because the FORMATMESSAGE function is being used and it was replaced by FORMATMESSAGE_UDF. The reason to add the warning is because the FORMATMESSAGE_UDF used to replace the FORMATMESSAGE does not handle properly all kinds of formats and it may throw an error on certain conditions.
Unsigned numerical values that are given as negative will preserve the sign instead of converting the value. Also, the %I64d placeholder is not supported by the UDF so it will throw an error when it is used.
In the FORMATMESSAGE_UDF, a error will happen if the given number of arguments is different than the number of placeholders.
This UDF does not support using message number IDs.
Code Example
Input Code:
SELECTFORMATMESSAGE('Unsigned int %u, %u', 50, -50); -- Unsigned int 50, 4294967246SELECTFORMATMESSAGE('Unsigned octal %o, %o', 50, -50); -- Unsigned octal 62, 37777777716SELECTFORMATMESSAGE('Unsigned hexadecimal %X, %x', -11, -50); -- Unsigned hexadecimal FFFFFFF5, ffffffceSELECTFORMATMESSAGE('Unsigned octal with prefix: %#o', -50); -- Unsigned octal with prefix: 037777777716SELECTFORMATMESSAGE('Unsigned hexadecimal with prefix: %#X, %x', -11,-50); -- Unsigned hexadecimal with prefix: 0XFFFFFFF5, ffffffceSELECTFORMATMESSAGE('Bigint %I64d', 3000000000); -- Bigint 3000000000SELECTFORMATMESSAGE('My message: %s %s %s', 'Hello', 'World'); -- My message: Hello World (null)
Output Code:
SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Unsigned int %u, %u', ARRAY_CONSTRUCT(50, -50)); -- Unsigned int 50, -50SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Unsigned octal %o, %o', ARRAY_CONSTRUCT(50, -50)); -- Unsigned octal 62, -62SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Unsigned hexadecimal %X, %x', ARRAY_CONSTRUCT(-11, -50)); -- Unsigned hexadecimal -B, -32SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Unsigned octal with prefix: %#o', ARRAY_CONSTRUCT(-50)); -- Unsigned octal with prefix: -0o62SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Unsigned hexadecimal with prefix: %#X, %x', ARRAY_CONSTRUCT(-11, -50)); -- Unsigned hexadecimal with prefix: -0XB, -32SELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('Bigint %I64d', ARRAY_CONSTRUCT(3000000000)); -- ErrorSELECT--** MSC-WARNING - MSCEWI4065 - FORMATMESSAGE WAS CONVERTED TO CUSTOM UDF FORMATMESSAGE_UDF AND IT MIGHT HAVE A DIFFERENT BEHAVIOR. **FORMATMESSAGE_UDF('My message: %s %s %s', ARRAY_CONSTRUCT('Hello', 'World')); -- Error
Recommendations
Avoid using %I64d placeholder in the message.
Use directly the message as a string instead of using a message ID for the first argument.
Make sure the number of placeholders is the same as the number of arguments after the message.