Converts a hexadecimal stream to its binary representation.
hextobin(hexString[, 'stream|pretty'])
The hexadecimal varchar
string hexString
is converted
to its binary representation, and the varbyte
result returned.
The optional second argument is a comma-separated string of any of the
following flags:
stream
: Only accept the stream
format of
bintohex()
, i.e. a stream of hexadecimal bytes, the same
format that convert(varbyteData, 'varchar')
would have
returned in Texis version 6 and earlier. Whitespace is
acceptable, but only between (not within) hexadecimal bytes.
Case-insensitive. Non-conforming data will result in an error
message and the function failing.pretty
: Accept either stream
or pretty
format data; if the latter, only the hexadecimal bytes are parsed
(e.g. ASCII column is ignored). Parsing is more liberal, but
may be confused if the data deviates significantly from either
format.
The hextobin()
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.