0

I'm trying to figure this query out and can't figure out how it relates:

Where   iInteractionOpenReasonID & 16 = 0

Possible values for iInteractionOpenReasonID should be:

0 Unknown
1 Normal Start
2 Normal End
4 Transfer Start
8 Transfer End
16 Conference
32 Inter Queue
64 Networking
128 Segment
256 Compound
512 Block
1024 Clip Recording

I'm seeing values of 129 and 145 (which aren't in the list) and that where clause filters out the 145...I'm confused

DoNotArrestMe
  • 1,285
  • 1
  • 9
  • 20
  • Yep, looks like it. When I searched I couldn't find anything but then again I didn't know you could use & in an actual search so I was typing it out – TalkingScientist Jan 17 '14 at 20:30

1 Answers1

3

"The & bitwise operator performs a bitwise logical AND between the two expressions, taking each corresponding bit for both expressions. The bits in the result are set to 1 if and only if both bits (for the current bit being resolved) in the input expressions have a value of 1; otherwise, the bit in the result is set to 0."

Try looking at the msdn doucmentation here. http://msdn.microsoft.com/en-us/library/ms174965.aspx

RubberDuck
  • 11,933
  • 4
  • 50
  • 95
  • I'm either more confused or less confused. Let's see 145 is Binary 10010001 129 is Binary 10000001 16 is Binary 10000 So if my clause says Where iInteractionOpenReasonID & 16 = 0 and iInteractionOpenReasonID = 129 then the result would be 1 because the first 5 digits of 10000001 are 10000 and iInteractionOpenReasonID = 145 then the result would be 0 because 10010001 does not contain 10000 – TalkingScientist Jan 17 '14 at 20:23
  • Sorry it flubbed up the formatting – TalkingScientist Jan 17 '14 at 20:29
  • @TalkingScientist I'm afraid I can't explain it any better than showdev did above with his link. – RubberDuck Jan 17 '14 at 20:29