database - How to perform bitwise operations on a value stored in a table and use it in where clause of sql query? -
This is the scenario that I have a 'column' flag in a table. This column stores a 32-bit binary number in decimal form is. For example 00000000000000000000000000000010 is stored as 2. I need to display all the records in the table, in which the value of the value stored in 'Flag' is set as the 26th bits '1'. How do I write SQL queries for this purpose?
Try this:
select> where (flag and 64) = 64 26 bit bit 2 ^ 6 = 64 corresponds to bit. On SQL Server, & amp; It will return a Bitwise-End and 64 only if the 64 bit is set in both operands.
Comments
Post a Comment