Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 29 Jul 1999 @ 18:19:04 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: How to check the value of a bit in a BYTE field.
From:   Glenn McCall

Are you able to redefine your tables so that they are defined using numeric datatypes?

If so, something like this would work for you:

     select cust_id, int_val
     from test
     where ((int_val / (2 ** (3-1))) (INTEGER)) mod 2 = 1
     order by 2

where the number 3 in the where clause is the bit number you wish to test (starting from 1 for the least significant bit).

If you could redefine your tables you may have a new problem in that an INTEGER is only 4 bytes, not 5.

I hope this helps in some small way.

Glenn McCall

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023