RE: Transact SQL question has me stumped

2008-02-06 Thread Mark Kruger
8:47 AM To: CF-Talk Subject: RE: Transact SQL question has me stumped Dennis... Learn something new everyday. I guess I did not know there was bit operator in CF :) -Original Message- From: Dennis Powers [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 1:11 PM To: CF-Talk Subjec

RE: Transact SQL question has me stumped

2008-02-06 Thread Mark Kruger
Dennis... Learn something new everyday. I guess I did not know there was bit operator in CF :) -Original Message- From: Dennis Powers [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 1:11 PM To: CF-Talk Subject: RE: Transact SQL question has me stumped Mark, I knew I would

RE: Transact SQL question has me stumped

2008-02-05 Thread Dennis Powers
Jeff, >> Ah, you changed the question :) You originally said AND, now it is OR! I knew I was phrasing it incorrectly mixing Boolean and linguistic "and" >> WHERE myColumn & myMask > 0 This is much too easy and I can't believe I overlooked so simple a basic Boolean solution. That sound you hear

Re: Transact SQL question has me stumped

2008-02-05 Thread Jeff Price
Ah, you changed the question :) You originally said AND, now it is OR! It doesn't change the problem much. Step 1: Create your mask Step 2: Zero out the bits we don't care about with Step 3: If we are left with anything, we have records that contain a flag. WHERE myColumn & myMask > 0 enjoy!

Re: Transact SQL question has me stumped

2008-02-05 Thread Jeff Price
doh! That should be 2^0 + 2^7 (silly me) > myMask = 2^1 + 2 ^8 ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive

RE: Transact SQL question has me stumped

2008-02-05 Thread Dennis Powers
Jeff, >> myMask = 2^1 + 2 ^8 >> SELECT mycolumns >> FROM mytable >> WHERE BigIntColumn & #myMask# = #myMask# This was exactly what I was doing - irrespective of the CAST to change data types - but it will only select records that have bit 1 AND Bit 8. What I need to do is to select records th

RE: Transact SQL question has me stumped

2008-02-05 Thread Brad Wood
Original Message- From: Dennis Powers [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 2:02 PM To: CF-Talk Subject: RE: Transact SQL question has me stumped >> You need a bitwise operator. Bit and is & in MS SQL >> SELECT mycolumns >> FROM mytable >

Re: Transact SQL question has me stumped

2008-02-05 Thread Jeff Price
I'm not Guru, but this should do it. First you create a mask by turning on the bits you need. myMask = 2^1 + 2 ^8 Then, bitwise AND (&) with your column. The result needs to be equal to your mask to have all the specific bits turned on. NOTE: This assumes you don't care about the value in the

RE: Transact SQL question has me stumped

2008-02-05 Thread Dennis Powers
>> You need a bitwise operator. Bit and is & in MS SQL >> SELECT mycolumns >> FROM mytable >> WHERE bit_column & 128 = 128 This was essentially what I was doing but it does not work properly for matching multiple bits in the "bit_column", Example: matching a row that has Bit 1 and Bit 8 (129)

RE: Transact SQL question has me stumped

2008-02-05 Thread Brad Wood
Original Message- From: Dennis Powers [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 1:11 PM To: CF-Talk Subject: RE: Transact SQL question has me stumped Mark, I knew I would most likely not explain it properly. The existing database has a column that contains values that ar

RE: Transact SQL question has me stumped

2008-02-05 Thread Dennis Powers
Mark, I knew I would most likely not explain it properly. The existing database has a column that contains values that are typed as a BigInt. I have a filter that gets constructed from Bit values for example: the filter = 129 which was constructed from bit 1 binary + bit 8 Binary 1 + 128. What

RE: Transact SQL question has me stumped

2008-02-05 Thread Mark Kruger
work :) -Mark -Original Message- From: Dennis Powers [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 05, 2008 12:01 PM To: CF-Talk Subject: Transact SQL question has me stumped I am hoping an SQL guru can assist me with what I am sure is a stupid little oversight or misunderstanding on my p

Transact SQL question has me stumped

2008-02-05 Thread Dennis Powers
I am hoping an SQL guru can assist me with what I am sure is a stupid little oversight or misunderstanding on my part. I hope I can explain this. I need to do a bit evaluation against data in the database where the data is stored in a BigInit column. Within my code I construct a bit filter and nee