BITANDNOT Function

The BITANDNOT function takes two arguments. The arguments can be any number type value that can be converted to an INT8 value.

Fractional values are truncated before the bit operation. The result is the same as BITAND(arg1, BITNOT(arg2)) for the two arguments.

If both arguments have the same integer types, the data type of the returned value is the same type as the arguments. If the arguments are of different integer types (for example, INT and INT8), the returned type is the type with the greater precision. If the arguments are any other numeric type, such as DECIMAL, SMALLFLOAT, FLOAT, or MONEY, or some combination of those types, the returned data type is DECIMAL(32).

The query in the following example calls the BITANDNOT function:
SELECT BITANDNOT(20,-20) AS bitandnot FROM systables WHERE tabid = 1;
The following table shows the output of this SELECT statement.
bitandnot
   16
The following query calls the equivalent BITAND and BITNOT functions for the arguments in the previous example:
select bitand(20, bitnot(-20)) as bitandnot from systables 
   where tabid = 1;


The following table shows the output of this SELECT statement.
bitandnot
   16