Datatype

casorohi

Member
Hi all need your help in understanding, which one data type would be more and best between two I.e integer or Boolean in following case.


Actually the required new table has 14 fields, out of which six fields value would be 0 or 1 (interger).


Want to know if we opt the Boolean data type would be more convenient or integer type ?
Which one give me the best performance and storage impact etc.
Thanks
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
On disk, OpenEdge stores logical fields as integers. The default value of false is stored as a 0, so it consumes one byte. A value of true is stored as a 1, which consumes two bytes.

In this case space consumption is secondary in importance to the intended use of the field. If you have a value which you know can only ever have two states (e.g. is customer deceased?), use a logical. If it has two states currently but could conceivably have more (account is "active" or "inactive"; possible future state of "on hold"), use an integer or a character.

Whether one data type is "more convenient" than another is a matter of personal taste and of how your code will use the fields or variables in question.
 

rzr

Member
If it permits choose the integer or character data type. It will give you a flexibility to expand in future if you have values other than 0 and 1.
 

tamhas

ProgressTalk.com Sponsor
I disagree ... if the field is inherently boolean, use boolean. If it isn't, then don't. Clarity trumps!
 
Top