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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 BitMasking

Author  Topic 

jimoomba
Yak Posting Veteran

90 Posts

Posted - 2011-09-30 : 09:12:24
Hi All,
Could anyone please provide me the query to assign a bitmax value and sum those bitmask values in a way where i will get the following values :
1)Sum of 1 and 3 is 3 and
2)Sum of 1 and 2 is 3

rams

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-09-30 : 09:26:40
You can use bit-wise OR. http://msdn.microsoft.com/en-us/library/ms186714.aspx

For example:

DECLARE @i1 INT, @i2 INT;

SET @i1 = 1; SET @i2 = 2;
SELECT @i1 | @i2;
Go to Top of Page

jimoomba
Yak Posting Veteran

90 Posts

Posted - 2011-09-30 : 09:31:41
Hi,

Thanks for the quick reply. I require example on bitmasking..like how to create a mask value in a table and how to use them. That would be a great help for me :)

rams
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2011-09-30 : 18:06:07
Can you elaborate on what you actually would like to accomplish?

=======================================
Faced with the choice between changing one's mind and proving that there is no need to do so, almost everyone gets busy on the proof. -John Kenneth Galbraith
Go to Top of Page

jimoomba
Yak Posting Veteran

90 Posts

Posted - 2011-09-30 : 22:28:49
Hi All,

Iam having users table with mask values 1--to view the only first page of the application, 2--view 2nd page..16--have admin rights ..etc
Could anyone provide me the sql query where i can give the rights to the users based n the mask values :

eg: 1. Suppose if i want to provide access rights to a user for first and second pages only....
2. What if i want to provide the admin rights to the user

Please send me the sql query

Thanks a lot:)

rams
Go to Top of Page
   

- Advertisement -