A varbinary is represented in hexadecimal form
The
data type of a literal that starts with
0x
is
varbinary and a varbinary is represented as a (hexadecimal) number that starts with
0x
.
This is demonstrated in the following example:
select
0x00 as col_0,
0x0102 as col_1,
0x0102030405060708090a0b0c0d0e0f as col_2
into
tq84_varbinary;
select * from tq84_varbinary;
-- col_0 col_1 col_2
-- ----- ------ --------------------------------
-- 0x00 0x0102 0x0102030405060708090A0B0C0D0E0F
select
column_name,
data_type,
character_maximum_length
from
information_schema.columns
where
table_name = 'tq84_varbinary'
order by
ordinal_position;
--
-- column_name DATA_TYPE CHARACTER_MAXIMUM_LENGTH
-- ----------------- ------------------- ------------------------
-- col_0 varbinary 1
-- col_1 varbinary 2
-- col_2 varbinary 15