Subject Re: Bit operations in Firebird SQL Ali Gökçen 2005-09-28T08:07:39Z
Hi,
there is no internal bitwise operator support in FB but you can do it
yourself some math operations.

is same as

lets try it with mask 01010111 = 2^0+2^1+2^2+2^4+2^6=1+2+4+16+64=87

87/4=21, 21*4=84, 87-84 = 3

dividing with 2 is means shifting one bit to right side.
we are elimanting right 2 bits by dividing by 4 (2 times 2)
then multipling this value with 4 again, now last two bits are zero
then substraction it from orijinal value gives us the last 2 bits.
a bit assaembly.. thats all.
If you are using bit field you should familiar with bit operations
like this..

if you want clean code in where operations then you can create
computed by bit values of that field.

where (BIT0=1 AND BIT1=1)

etc..

Regards.

Ali

--- In firebird-support@yahoogroups.com, "mobiltexmark" <mbentley-
keyword-yahoo.ae8df5@m...> wrote:
> I have a field that defines a bitmask and would like to have the sql
> search return data based on the mask, but can not seem to find
> anywhere describing bit operations. What I would like is something
> like:
>
> SELECT * FROM TABLE_NAME