Converts a binary (varbyte
) value into a hexadecimal string.
bintohex(varbyteData[, 'stream|pretty'])
A string (varchar
) hexadecimal representation of the
varbyteData
parameter is returned. This can be useful to
visually examine binary data that may contain non-printable or nul
bytes. The optional second argument is a comma-separated string of
any of the following flags:
stream
: Use the default output mode: a continuous
stream of hexadecimal bytes, i.e. the same format that
convert(varbyteData, 'varchar')
would have returned in
Texis version 6 and earlier.pretty
: Return a "pretty" version of the data: print
16 byte per line, space-separate the hexadecimal bytes, and print
an ASCII dump on the right side.
The bintohex()
function was added in Texis version 7. Caveat:
Note that in version 7 and later, convert()
ing data from/to
varbyte
/varchar
no longer converts the data to/from
hexadecimal by default (as was done in earlier versions) in programs
other than tsql
; it is now preserved as-is (though truncated at
nul for varchar
). See the hexifybytes
SQL property
(here) to change this.