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 rest of the bits.

SELECT  mycolumns
FROM  mytable
WHERE  BigIntColumn & #myMask# = #myMask#

NOTE: I don't think you have to cast anything as long as you are dealing with 
ints...but this is the part where I mention IANAG (I am not a guru).

-jeff


>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 need to select all records where the logical AND
>of that value against the BigInt field is "true".
>
>For example If my bit filter = 129 (1*2) + (8*2) What I need to do is select
>all records Where the BigInt Column has bit 1 AND bit 8. I am not sure how
>to evaluate this function in a where clause.
>
>
>SELECT  mycolumns
>FROM  mytable
>WHERE  BigIntColumn & CAST(#filter# as BigInt)) = {and this is where I fall
>down}
>
>Any help is appreciated.
>
>
>Best Regards,
>
>Dennis Powers
>UXB Internet - A website design and Hosting Company
>690 Wolcott Road
>P.O. Box 6029
>Wolcott, CT  06716
>Tel: (203)879-2844
>http://www.uxbinternet.com/
>http://www.uxb.net/ 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298248
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to