![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 3 of 3 total |
![]() |
Fri, Dec 5 2014 11:42 AM | Permanent Link |
Mirco Malagoli | Hi,
I am storing binary value as an Integer in a table. I need to check if a particular bit is set. How can I do without & operator? Thanks |
Fri, Dec 5 2014 1:38 PM | Permanent Link |
Raul ![]() | On 12/5/2014 11:42 AM, Mirco Malagoli wrote:
> I am storing binary value as an Integer in a table. I need to check if a particular bit is set. > How can I do without & operator? Bitwise operations are not currently present in DBISAM SQL. They are still on the roadmap (have been for awhile now). Options i can suggest: - do a custom engine function for Bitwise AND - use delphi code - convert data into separate boolean fields if you need to use SQL Raul |
Mon, Dec 8 2014 8:24 AM | Permanent Link |
Fernando Dias ![]() | Mirco,
In addition to what Raul said, if you want to use SQL you can also use this expression: CAST(X/POWER(2,N) AS INTEGER) MOD 2 where X is your integer column and N is the order of the bit that you want to test. The expression evaluates to the value of the Nth bit. Please be aware that it only works for X >= 0, so you can't use the 31th bit. -- Fernando Dias [Team Elevate] |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |