VARCHAR_TO_VARBINARY

SYS_BOOT.MGMT.VARCHAR_TO_VARBINARY(sourceString VARCHAR(65535))
Returns VARBINARY(65535)

This function converts a hex-encoded binary string (a VARBINARY literal) into the corresponding VARBINARY value. For instance, it converts the string ‘01020304’ into the byte array [1,2,3,4].

The VARBINARY type is similar to the VARCHAR type, but it stores binary byte strings instead of character strings. For more details on s-Server’s data types, see the topic SQLstream Data Types.

Because this conversion relies on binaries, you need an even number of digits in the VARCHAR source string: one pair for each byte in the VARBINARY. ‘12345’ fails, for example.

Example

` values VARCHAR_TO_VARBINARY(01020304); 'EXPR$0' '01020304' The inverse operation is SYS_BOOT.MGMT.VARBINARY_TO_VARCHAR().