September 02, 2010     |
Network Toaster
SQL Security Forums
Note: SQLSecurity.com does not allow nor require registration due to privacy concerns for users. SQLSecurity.com is open and anonymous for all. Please report any abuse or profanity.
Subject: bit comparing w/sql
Prev Next

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

Forums > Discussions > SQL Server Security > bit comparing w/sql

Quick Reply
Username:  
Subject:  
Body:
 



ActiveForums 3.6
Copyright 1999 by Chip Andrews   |  Privacy Statement  |  Terms Of Use