I've encountered a bit of a mental roadblock regarding the way a specific integer field is storing data.
Specifically, there is a column with integers that range from 1 - 127; each integer represents a combination of different days of the week. For example: Monday = 2^0 or 1, Tuesday = 2^2 or 2, Wednesday = 2^3 or 8; with the option of addition, Monday + Tuesday = 3.
I've been able to extract the date values partially using the example found here. However, that particular example does not work when two days get added together (eg. Monday + Tuesday = 3). Can anyone point me in the right direction?
FYI, I am using SQL Server 2008 R2. My apologies if this has been posted before, I took a look but was unable to find any other postings.
What you're dealing with is referred to as bitwise operators.
Here's a good read on it with clear simple examples.
For the sake of completeness, here is what you're looking at broken down into columns for each day of the week.
You'll need to use bitwise operators, most likely.
Or, if it makes more sense:
I strongly suggest you create a VIEW with a query like @JNevill describes.
It seems like you could just grab the bit you need and store the result in their own field for each day of the week.