Takes n bit arrays and returns a bitwise AND-ing of its arguments using the following logic: for each bit compared, if all bits are 1, return 1; otherwise, return 0.
BIT_AND( bit-expression )
expression The expression for which the value is to be determined. This is commonly a column name.
LONG VARBIT
SQL/2003 Vendor extension.
The following example generates four rows containing a CHAR column, then converts the values to VARBIT.
SELECT BIT_AND( CAST(row_value AS VARBIT) ) FROM dbo.sa_split_list('0001,0111,0100,0011') |
The result 0000 is determined as follows:
A bitwise AND is performed between row 1 (0001) and row 2 (0111), resulting in 0001 (both values had a 1 in the fourth bit).
A bitwise AND is performed between the result from the previous comparison (0001) and row 3 (0100), resulting in 0000 (neither value had a 1 in the same bit).
A bitwise AND is performed between the result from the previous comparison (0000) and row 4 (0011), resulting in 0000 (neither value had a 1 in the same bit).
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |