I have a table like this:
create table t (
t0 datetime year to fraction,
t1 datetime year to fraction(1),
t2 datetime year to fraction(2),
t3 datetime year to fraction(3),
t4 datetime year to fraction(4)
);
Now I'd like to reverse engineer this table's data type information. I'm mostly interested in the fractional seconds part, but if I can find the other qualifier information, even better. The following query doesn't work:
select
c.colname::varchar(10) colname,
informix.schema_coltypename(c.coltype, c.extended_id)::varchar(10) coltypename,
c.collength,
informix.schema_precision(c.coltype, c.extended_id, c.collength) precision,
informix.schema_numscale(c.coltype, c.collength) numscale,
informix.schema_datetype(c.coltype, c.collength) datetype,
c.coltype
from syscolumns c
join systables t on c.tabid = t.tabid
where t.tabname = 't'
It yields
|colname |coltypename|collength|precision |numscale |datetype |coltype|
|----------|-----------|---------|-----------|-----------|-----------|-------|
|t0 |DATETIME |4365 |4365 | |60 |10 |
|t1 |DATETIME |3851 |3851 | |60 |10 |
|t2 |DATETIME |4108 |4108 | |60 |10 |
|t3 |DATETIME |4365 |4365 | |60 |10 |
|t4 |DATETIME |4622 |4622 | |60 |10 |
The collength seems to contain the relevant information, but I cannot extract it with schema_precision or schema_numscale as is otherwise possible for numeric precisions. Also, schema_datetype yields no interesting results.
How can I reverse engineer the coltype information back to datetime year to fraction(N)?