Re: Size of columns
Posted in 1995
} } > > From: chessec@aztec.co.za (Claude Chesselet) } > > Subject: Size of columns } } > Can anyone help? } > } > I need to determine the length of columns from the syscolumns table where the } > column type is a decimal and when attempting to determine the length I do not } > know the precision or the scale of the column. } > } > Does anyone know how to do this? } > } > } } Assuming iColLength has the value from syscolumns:collength } } uHigh = (unsigned) iColLength / 256; } uLo = (unsigned) iColLength % 256; } } if (uLo == 255) /* Floating Point */ } sprintf(szType,"DECIMAL(%d)",uHigh); } else } sprintf(szType,"DECIMAL(%d,%d)",uHigh,uLo); } } I found _most_ of this in Informix Quide to SQL/Reference - } chapter: System Catalog. } There is also a very good example in the 4gl by example manual and demo code directory. Of course it doesn't handle an interval with specified precision correctly, but otherwise it's quite good. If you would like code which does read the catalogues correctly then I suggest col_cnvrt(), fix_nm() and fix_dt() from dbdiff2.4gl. Which I should be posting in the next day or seven. cheers j. _____________________________________________________________________________ Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA jparker@hpbs3645.boi.hp.com _____________________________________________________________________________ "Character is what you are in the dark" - Emilio Lizardo _____________________________________________________________________________ Any opinions expressed herein are my own and not those of my employers. _____________________________________________________________________________