Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
The poster asked how, from 4GL code, to retrieve a column's declared maximum length (e.g. the 20 in CHAR(20)) rather than the longest stored value. An initial suggestion of SELECT MAX(LENGTH(col)) was off-target, but others gave the right answer: query the system catalogs, e.g. SELECT collength FROM systables t, syscolumns c WHERE t.tabid = c.tabid AND tabname = ... AND colname = ... The poster confirmed the problem was solved; a pointer to the SQL Reference manual's catalog documentation was also given.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Erik Kurz — — source: Usenet: comp.databases.informix
hi,
how do i get the max. length for a column-entry
(defined in a table) within a 4gl-code ?
thanks for help
erik
↪ replying to Erik Kurz
Dave Griffen — — source: Usenet: comp.databases.informix
select max(length(myfield))
into intprogvar
from mytable
"Erik Kurz" <erik.kurz@analytika.at> wrote in message
news:415ac499$1@e-post.inode.at...
> hi,
>
> how do i get the max. length for a column-entry
> (defined in a table) within a 4gl-code ?
>
> thanks for help
>
> erik
>
>
Erik Kurz — — source: Usenet: comp.databases.informix
sorry for my bad english, but i need to know
the definition of a field in a table.
example:
field1 is defined as CHAR(20)
.. so i want to get "20" into my progvar, not the value
which is entered into this field.
i hope it is understandable now
thanks
erik
"Dave Griffen" <dgriffen@nospam.finishline.com> schrieb im Newsbeitrag
news:cjeh3u$u65$1@news.onecall.net...
> select max(length(myfield))
> into intprogvar
> from mytable
>
> "Erik Kurz" <erik.kurz@analytika.at> wrote in message
> news:415ac499$1@e-post.inode.at...
> > hi,
> >
> > how do i get the max. length for a column-entry
> > (defined in a table) within a 4gl-code ?
> >
> > thanks for help
> >
> > erik
> >
> >
>
>
↪ replying to Christian Knappke
Erik Kurz — — source: Usenet: comp.databases.informix
problem solved
thank you
erik
"Christian Knappke" <chknews@gmx.net> schrieb im Newsbeitrag
news:Xns9573A8BFD6678nnsshiqqcuusnqfigmxn@10.16.7.20...
> From the keyboard of "Erik Kurz" <erik.kurz@analytika.at>:
>
> > how do i get the max. length for a column-entry
> > (defined in a table) within a 4gl-code ?
>
> select collength from syscolumns c, systables t where c.colname => '<column name>' and t.tabname = '<table name>' and c.tabid = t.tabid
>
> > thanks for help
>
> HTH
>
> Christian
> --
> #include <std_disclaimer.h>
> /* The opinions stated above are my own and not
> necessarily those of my employer. */
SELECT collength
FROM systables t, syscolumns c
WHERE t.tabid = c.tabid
AND tabname = ?
AND colname = ?
The system catalogs are fully described in the SQL Reference manual.
Look for your version under Database Servers at:
www.ibm.com/software/data/informix/pubs/library
--
Regards,
Doug Lawry
www.douglawry.webhop.org
"Erik Kurz" <erik.kurz@analytika.at> wrote in message
news:415aca0b$2@e-post.inode.at...
> sorry for my bad english, but i need to know
> the definition of a field in a table.
>
> example:
> field1 is defined as CHAR(20)
>
> .. so i want to get "20" into my progvar, not the value
> which is entered into this field.
>
> "Dave Griffen" <dgriffen@nospam.finishline.com> schrieb im Newsbeitrag
> news:cjeh3u$u65$1@news.onecall.net...
>
> > select max(length(myfield))
> > into intprogvar
> > from mytable
> >
> > "Erik Kurz" <erik.kurz@analytika.at> wrote in message
> > news:415ac499$1@e-post.inode.at...
> >
> > > how do i get the max. length for a column-entry
> > > (defined in a table) within a 4gl-code ?
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.