Ok, so the problem is that you want the where clause to be dynamic based
on some user-entered search criteria?  So you want to match 0 to n
possible bits?

I see two possible SQL solutions right off:
1) Populate temp table with candidate records in a cursor or while loop
for each filter (yuck)
2) Dynamic SQL.

I would do the latter.

Dynamically create a SQL string which looks like this:

SELECT  mycolumns
FROM  mytable
WHERE  bit_column & 1 = 1
        AND bit_column & 8 = 8
        AND bit_column & 32 = 32
        AND bit_column & 128 = 128
        Ect ...

~Brad

-----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
>> 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) or matching a row that has Bit 1 and Bit 4
(9).

Is my only choice looping over the filter and dynamically constructing
the
Where clause from the binary value of the "filter"? 

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

Reply via email to