Hi all,
here is the example of using Bitwise Logical AND
Performs a bitwise logical AND operation between two integer values.
Syntax for using this is: 1st Statement & 2nd Statement
for example use this query in Sql server select 50 & 60 you will get the result as 48
These Statements will be of Integer, bit, binary and varbinary data types. Statements will be used as binary number for the bitwise operation.
If the left and right statements have different integer data types, lets assume the left statement is smallint and the right statement is int, the argument of the smaller data type is converted to the larger data type. In this case, the smallint statement is converted to an int.
The binary representation of 50 is 0011 0010. The binary representation of 60 is 0011 1100. Performing the bitwise AND operation on these two values produces the binary result 0011 0000, which is decimal 48. 0011 0010 0011 1100 0011 0000 this is equal to 48
Note: while using "&" 0+0=0, 0+1=0, 1+1=1
i am writing an article "Binary Represenation" too to get the binary code also. happy coding
|
| Author: thebarrett27 12 Jun 2008 | Member Level: Bronze Points : 0 |
nice article
|