Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
WebInspired
Starting Member
1 Post |
Posted - 2012-07-16 : 07:51:55
|
In a SQL table I have a field declared as binary(16), which effectively I use to store a bit mask of settings for a web app.In my actual web app (using .NET Entity Frameworks), I store a 1 or a 0 in specific positions to indicate if a permission is set or noteg... //Define BWAND Process bit positions private const int pPAF = 1; private const int pPING = 2; private const int pDedup = 3; private const int pProfanity = 4; private const int pTelVerify = 5;then set by my field - which is called ProcessBWAND - as follows, exampleProcessBWAND[pPING] = (byte)0 or (byte)1this all works fine for storing the values etc so I may get an entry (from SQL Manager) like this.0x00010101010100000000000000000000Which means all the above bit flags have been set.Anyway my question is, how from a SQL query can I test if any of the records for example have a specific bit set in the ProcessBWAND field? |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-16 : 09:20:34
|
Try using and (&) to check for bitsSeehttp://www.nigelrivett.net/SQLTriggers/Columns_updated.htmlThat gets the bits that are set.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|