You need a bitwise operator.  Bit and is & in MS SQL

SELECT  mycolumns
FROM  mytable
WHERE  bit_column & 128 = 128

Should be along the lines of what you want I think.

This example works for me on MS SQL 2005:

declare @test as bigint
set @test = 128

select @test & 128

~Brad

-----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 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 I need to do is write a select statement where it returns all rows that
where the  BigInt column has bit 1 AND Bit 128.  So it would select rows
where the bigInt column contained:

1
3
5
128
129
384
385

SELECT  mycolumns
FROM  mytable
WHERE  ?????

Thanks!

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:298244
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