| Author |
Messages |
|
troyfisher@aol.com
 |
| 10/30/2001 11:30 PM |
Quote
Reply
Alert
|
| Is it possable to use bit comparing in SQL statements? If I use bit numbers(ie.. &H000001) for security permissions, how would I do a search for 2 different levels? I have about 5 different security settings that users can have. I need to do a search and retrieve anyone with any of these 5 settings. Any ideas for the sql? |
|
|
|
|
Chip Andrews
 |
| 10/31/2001 10:55 AM |
Quote
Reply
Alert
|
| Sure - SQL Server has a collection of bitwise operators to facilicate exactly this:
& (Bitwise AND)
~ (Bitwise NOT)
| (Bitwise OR)
^ (Bitwise Exclusive OR)
For example:
SELECT 7 & 5
GO
------
5
because:
0111
0101 &
----
0101
as expected
Chip |
|
|
|
|
|
|
|
|
|
Quick Reply |
 |
|
|
|