Re: syscolumns.collength
Posted in 1994
robertsn@sse.ie (Andrew Robertson) writes:
>Having created the following table ( INFORMIX Online 4.10 ) :
> create table times
> ( dtime1 datetime year to second,
> dtime2 datetime hour to second );
>I see the following values of COLLENGTH in the SYSCOLUMNS view:
> colname collength
> ------- ---------
> dtime1 3594
> dtime2 1642
Page 2-12 of the Informix SQL Reference manual (Dec 1991) describes how to
compute the column length. In case you don't have it, it says:
"For columns of type DATETIME or INTERVAL, collength is determined
using the following formula:
(length * 256) + (largest_qualifier * 16) + smallest_qualifier value
The length is the physical length of the DATTETIME or INTERVAL
field, and the largest_qualifier and smallest_qualifier have the
following values:
Field qualifier Value
YEAR 0
MONTH 2
DAY 4
HOUR 6
MINUTE 8
SECOND 10
FRACTION(1) 11
FRACTION(2) 12
FRACTION(3) 13
FRACTION(4) 14
FRACTION(5) 15
For example, if a DATETIME YEAR TO MINUTE has a length of 12 (such
as YYYY:DD:MM:HH:MM), a largest_qualifier value 0 (for YEAR), and a
smallest qualifier value 8 (for MINUTE), the collength value is 3080
((256*12) + (0*16) + 8)."
Hope this helps...
Troy
==============================================================================
Troy L. Hewitt, CSE INFORMIX-Federal Client Services
Washington, D.C. (703) 524-3600 e-mail: troy@informix.com
==============================================================================