Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
BYTE FIELD SET/GET BIT (16 flags) |
Thu, Jul 4 2024 2:50 AM | Permanent Link |
Andrew Hill | I have a Table with a Map Field (2 bytes=16positions):= "Map" BYTE(8) DEFAULT X'0000000000000000' (this will hold 16 flags which can be viewed/set as either 1 or 0)
How do I test for position 15 X'nnnnnnnnnnnnnn1n' to see if it is = 1 in a SELECT statement ? How do I UPDATE MyTable SET Map = X'nnnnnnnnnnnnnn1n' position 15 to 1 without affecting the others ? Please advise - Thanks |
Thu, Jul 4 2024 7:00 PM | Permanent Link |
Fernando Dias Team Elevate | Andrew,
BYTE(8) is 8 bytes = 64 bits, not 16. Anyway, about your question: It's possible, but not efficient. The only way I can think of to do this is to define a UDF implemented in an external module (dll) and use binary masks to test/set values. Using only SQL I am not aware of any way to execute bit level operations (and it would defeat the basic principles of relational databases anyway). -- Fernando Dias [Team Elevate] |
Fri, Jul 5 2024 6:34 PM | Permanent Link |
Andrew Hill | Yes but I was referring to 16 possible states of 1 or 0
|
Fri, Jul 5 2024 6:35 PM | Permanent Link |
Andrew Hill | Visually seeing the 16 flag states as well
|
Sun, Jul 7 2024 12:04 AM | Permanent Link |
Andrew Hill | Want 16 flags, trying BYTE for speed, could do STRING instead but prefer BYTES
Please show how to Read Bit from Byte, and then set Bit in Byte. |
This web page was last updated on Wednesday, August 14, 2024 at 02:26 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |