bitwise operation questions
From: Craig Buchanan (someone_at_somewhere.com)
Date: 02/26/04
- Next message: Walter: "Insert command not appending to table"
- Previous message: Narayana Vyas Kondreddi: "Re: Create Custom Error Message"
- Next in thread: Tom Moreau: "Re: bitwise operation questions"
- Reply: Tom Moreau: "Re: bitwise operation questions"
- Reply: Joe Celko: "Re: bitwise operation questions"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 26 Feb 2004 16:02:16 -0600
I would like to store mailing-list preferences in an Int field using bitwise
operators, but I'm having a bit of difficultly. The field is named
'EmailFlags'. The values for the lists are: 1=ListA, 2=ListB and 4=ListC.
Questions:
1). If I want to set the preference value to include listb and listc, how
do I contruct the SQL?
UPDATE table
SET EmailFlags= 2 | 4
2). If I want to get a list of rows that are on list B and C, how do I
construct the SQL?
SELECT *
FROM table
WHERE EmailFlags = 2 or 4
3). If I want to remove listB from a given row, without eliminating the
other flags, how do I construct the SQL?
UPDATE Table
SET EmailFlags = ???
WHERE Id=...
Thanks,
Craig Buchanan
- Next message: Walter: "Insert command not appending to table"
- Previous message: Narayana Vyas Kondreddi: "Re: Create Custom Error Message"
- Next in thread: Tom Moreau: "Re: bitwise operation questions"
- Reply: Tom Moreau: "Re: bitwise operation questions"
- Reply: Joe Celko: "Re: bitwise operation questions"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|