Subject Re: [firebird-support] ASCII values
Author Mark Rotteveel
On 2018-03-09 06:33, hugo.larson@... [firebird-support] wrote:
> I have a column char(2) where two ASCII values stored. For example
> 00000011, 00000001 are stored as (3,1).
> When I do a select I dont get any result because the result is not
> alphanumeric. 3 is ETX and 1 is NUL.
> I can get the values programmatically but I want to do bit comparison
> with sql query.
> Anyone might know how?

You can use hex literals[1] for that, eg

yourcolumn = x'0301'

This requires Firebird 2.5 or higher.

Be aware that 0x01 is not NUL, it is SOH (Start Of Heading), NUL is
0x00.

Mark

[1]:
https://firebirdsql.org/file/documentation/release_notes/html/en/2_5/rnfb25-dml.html#rnfb25-dml-hex