Re: SQL Syntax - like FIELD and BITPATTERN = BITPATTERN? - Mailing list pgsql-general

From Harvey, Allan AC
Subject Re: SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?
Date
Msg-id E97A5BB7699CAD48BE2711E7124711650601ADDA@ntlmsg03.onesteel.com
Whole thread Raw
In response to SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?  (Ozz Nixon <ozznixon@gmail.com>)
List pgsql-general
> I do not know how to really describe this...
>
> In pascal I would do
>
>         If (AField and Flag3)=Flag3 then ...
>
> Checking to see if AField contains the BIT(s) FLAG3 is set to... is
> there a way to do this in a SELECT statement -- select * from ATable
> where AField and 0x0004=0x0004
>
> ?
>
> Thanks,
> O.
>
perhaps select * from ATable where AField::bit(16) & B'000000000100' = B'0000000000000100';

Allan


The material contained in this email may be confidential, privileged or copyrighted. If you are not the intended
recipient,use, disclosure or copying of this information is prohibited. If you have received this document in error,
pleaseadvise the sender and delete the document. Neither OneSteel nor the sender accept responsibility for any viruses
containedin this email or any attachments. 

pgsql-general by date:

Previous
From: Greg Fischer
Date:
Subject: Re: Trigger help - updates to column data with null values
Next
From: Ben Eliott
Date:
Subject: Fwd: createdb but revoke dropdb