Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performing a Bitwise comparison in an Access Query

Status
Not open for further replies.

Guggly

Programmer
Jan 18, 2004
110
US
Hi! Is it possible to perform a bitwise comparison directly in a query (I guess in a field value)? Or do I need to write a function that will do this, as some reference I have found suggests.

Thanks for your help! -- Mike
 
Yes, you do need to write a function. SQL comparison operators like AND, OR, NOT do boolean comparisons ... not bit comparisons.
 
Access (ie SQL) is not designed to do bit operations. If you use Access to store bit structures you've just got a very slow file system. It's a bit like buying an automobile just to listen to the radio.

 
Well, it's not really a major "bit operation" per se. It's just one field in a database I'm using contains flag values which dictate certain events. I need to evaluate those to see what else needs to get done with the record and hopefully that won't make for too much of an overload.
 
Jst to prove me wrong, I note MySQL provides bit operations.

Wouldn't something like YYNYNNYYNNNYNYN do?

 
Yes, that would work too, but I'm not designing the database, just working with what's there already
 
you have to change the database options to make it compatible with ANSI92 syntax, then you can use BOR and BAND operators
 
Max, I finished this project 6 months ago :), but seeing as you brought up an interesting point, is this something that can be supported directly from the Access JET implementation of SQL or would it still need to go through a VB function? Thanks! -- Mike
 
I'm sorry... I've seen your post today because I need to do the same thing...
No, U don't have to go through a VB Function, your query should be something like:

SELECT ... FROM ... WHERE (flagFld BAND 2) > 0

and it will return all the record that have the 2nd bit set in the field flagFld.
I suggest to set the option on a new database, because the syntax is a bit different and previous queries could not work.

Bye, Max
 
Looks interesting. I'll look into that when I get the chance. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top