Re: boolean/binary datatype
Posted in 1996
Jason P. Williams wrote: > Is there a boolean/binary datatype? My situation is that I am keeping > track of events (such as movies, concerts, etc) and I would like to be > able to classify each one as free or not-free (as in admission price). It > would be nice to have the attribute Free which could be either true or false. There is no boolean data type as such. However, most Informix tools treat FALSE as 0 (zero), and TRUE as non-zero. Therefore it is simple to store boolean values in the data type SMALLINT. This does however take 2 bytes of storage. Although it keeps the code cleaner, if you have lots of booleans, and are worried about space then the only alternative is to use CHAR(1). Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+